News for hackers. Stuff that matters.
Re:Falcon: A high-performance web server for Ruby, supportin... by frankwiles on Sunday October 21, 2018 @08:41PM (#18271277)
It’s a shame this has the same name as a high performance Python web framework as well. https://falconframework.org/
Re:Falcon: A high-performance web server for Ruby, supportin... by ransom1538 on Sunday October 21, 2018 @11:44PM (#18272044)
Php has its “p”falcon project too:

https://phalconphp.com/en/

Each night before bed I hope this project EOLs.

Re:Falcon: A high-performance web server for Ruby, supportin... by Twirrim on Monday October 22, 2018 @12:35AM (#18272208)
Having never looked at it.. why? Is it particularly bad in some way?
Re:Falcon: A high-performance web server for Ruby, supportin... by Lordarminius on Monday October 22, 2018 @02:03AM (#18272515)
I see no problem here.

Different languages, different frameworks. There is no namespace collision.

Re:Falcon: A high-performance web server for Ruby, supportin... by xaduha on Monday October 22, 2018 @08:36AM (#18274098)
It's a shame neither of those Falcons made it here

https://www.techempower.com/benchmarks/

Re:Falcon: A high-performance web server for Ruby, supportin... by DrJosiah on Tuesday October 23, 2018 @01:39AM (#18280968)
They list the Python Falcon variant in their filters, and it used to be up there in previous editions.
Re:Falcon: A high-performance web server for Ruby, supportin... by moocowtruck on Monday October 22, 2018 @09:05AM (#18274275)
it would be cool since this is claiming high performance
Re:Falcon: A high-performance web server for Ruby, supportin... by giancarlostoro on Sunday October 21, 2018 @09:22PM (#18271454)
Yeah one of the first things I do when I want to make a project is google the name to see what is using it already. If its too popular or too close to what I am solving I dont use the name. Reminds me of that WAMP Protocol (which I found a stupid name cause the acronym already says protocol at the last P) which collided with WAMP the Windows Apache MySQL PHP project. The engineer apparently didnt care. I wish engineers would stop to think because poor naming could ruin a project or product.
Re:Falcon: A high-performance web server for Ruby, supportin... by 0xfeeddeadbeef on Monday October 22, 2018 @08:17AM (#18274006)
Looks like it's a common theme among web frameworks: ASP.NET Core has Kestrel, i.e. small falcon.
Re:Falcon: A high-performance web server for Ruby, supportin... by ilovecaching on Sunday October 21, 2018 @09:23PM (#18271455)
Naming things is hard.
Re:Falcon: A high-performance web server for Ruby, supportin... by aviv on Sunday October 21, 2018 @11:18PM (#18271953)
Not if you google "falcon http"
Re:Falcon: A high-performance web server for Ruby, supportin... by brennebeck on Monday October 22, 2018 @01:24AM (#18272383)
I always assumed in this case that it was due to Monty Python rather than anything else (I.e. the prevalence of Falcon-name-themed high-performance frameworks is due to Monty Python).
Re:Falcon: A high-performance web server for Ruby, supportin... by ioquatix on Monday October 22, 2018 @02:50AM (#18272663)
Can you explain the reference?
Re:Falcon: A high-performance web server for Ruby, supportin... by ziikutv on Sunday October 21, 2018 @11:17PM (#18271948)
Indeed. Additionally, not take anything away from the Ruby counter part, the Python project is amazing and we use it in production. I really prefer the endpoint and viewmethod declaration methods in Falcon over Flask

    # In this example, I use blueprint plugin
    @bp.route('/', methods=['PUT'])
    def create_resource():
        return
vs

    class Resource(...):
        def on_put(self, request, response):
            return
Mirror: https://pastebin.com/50W8TJV2

Flask's hooking logic [1] is nice but I much prefer Falcon's middleware logic [2]. This then ties into the fact that Flask's design requires working with `g` [3] (essentially a global object) where as the middleware design leads us to bake in data in the request object. The example blow demonstrates how middleware definition works and how "adding data" per request works in both of these frameworks.

    # Flask; assuume `app` exists
    from flask import g
    @app.before_request
    def before_request():
        g.some_variable = 'foobar'
vs

    class ExampleComponent(object):
        def process_request(self, req, resp):
            req.some_variable = 'foobar'
Mirror: https://pastebin.com/Z3yGCfzF

Additionally, Falcon middleware API also exposes `process_resource` which is similar to above but also allows us to _pass_ arguments to the routed resource instance.

[1] http://flask.pocoo.org/docs/1.0/api/#flask.Flask.before_requ...

[2] https://falcon.readthedocs.io/en/stable/api/middleware.html

[3] http://flask.pocoo.org/docs/1.0/appcontext/#storing-data

Edit: Formatting