Live data from Hacker News

Crow – C++ Microframework for Web, inspired by Python Flask

github.com

61–65 of 65 posts

Re: Crow – C++ Microframework for Web, inspired by Python Flask

#61
The way the crow::black_magic::get_parameter_tag works is very impressive. I don't think I ever would have thought to do this with a recursive constexpr like that. I'm a huge fan of providing compiler errors whenever possible, so I'm glad to be able to add this trick to my toolbox.

Re: Crow – C++ Microframework for Web, inspired by Python Flask

#62

The way your routes work mean that a response is expected to be immediately generated and returned. It would be much nicer if a response object was passed to the callback and you could return immediately from the callback, but send a response independently, when you are ready. Kind of like this: CROW_ROUTE(app, "/about") ([](Response res){ res.send("About Crow example"); }); Why you might ask? So you can do this: CRO…

Seems like you could do something much cleaner by simply using Boost.Coroutine or some such...

Re: Crow – C++ Microframework for Web, inspired by Python Flask

#63
post #27
post #24

Earlier quoted context omitted.

> because all the code becomes inline. The language says that's just a suggestion to the compiler, right? Does any compiler actually inline for non-trivial methods?

`inline` has a different meaning in C++. The compiler is free to inline the call if it wishes to, but `inline` means that the same function can be defined in multiple translation units without breaking the one definition rule. Example: // header.hpp inline int f(int x) { return x + 1; } // a.cpp #include "header.hpp" // b.cpp #include "header.hpp" If f was not marked inline, linking a.cpp and b.cpp together would fin…

Note that in C++, if you really want to have just want definitions in multiple translation units you should just use an anonymous namespace...

Re: Crow – C++ Microframework for Web, inspired by Python Flask

#64

Earlier quoted context omitted.

How do you justify mass recompilations for every minor version bump or bugfix to your users?

This is only a problem if the user structured their code horribly. The library handles HTTP requests, it should be on the edge of the architecture. Side note: C++ is fantastic in this regard because it makes you suffer every time for excessive coupling. The compile/link times act as a recognizable metric that devs have an interest in minimizing, and the process of doing so produces better code. I love that it is ruth…

> This is only a problem if the user structured their code horribly. The library handles HTTP requests, it should be on the edge of the architecture.

Even then you will be rebuilding and redeploying the edge of your architecture every time this library gets a minor minor version number bump.

I would choose not to have to do that, every time.

Re: Crow – C++ Microframework for Web, inspired by Python Flask

#65
post #46

Earlier quoted context omitted.

`inline` indicates to the compiler: "this function has external linkage, and no matter how many times it's defined it is to be defined only once in the final linked output". It's the same as if there was no inline, but when the linker finds multiple definitions of the same function it is allowed to ignore them instead of failing. It also serves as a inlining hint to the compiler in its free time. Note that you don't…

'static' is old. It must have meant something to Kernighan and Ritchie. I see no connection to the word inline in the C++ meaning. In C, at least, inline means inline. My guess is that the C++ inline got its meaning from the winding path of c++ history, and only makes sense in the context of that history.

I guess it is that in C++, methods implemented in the class declaration are implicitly "inline". It could be done to avoid the problem outlined above.
Post reply on HN