Show HN: The Silicon C++14 Web Framework
github.com
github.com
The same comments apply to a lesser extent to the C++14 requirement- does your framework really benefit from using C++14 features over say C++11 ? Again I would make this clear at the top of the README.
[...]
@test
[...]
is equivalent to:
iod_define_symbol(test, _test)
[...]
s::_test
[...]
Their is 3 reason for implementation of the @ syntax:
- Not having to pre-declare all the symbols.
- Replacing s::_ by @
- Suggesting a new simple but powerful feature to
the teams writing clang++ and g++.
And yes, silicon needs generic lambda function from C++14 . But this is less a problem since this is already in g++, clang++, and soon in the visual studio c++ compiler.EDIT: Down votes? lol
It would be really convenient to have it done by the C preprocessor, but it seems impossible to me to get it with macro only. Am I wrong?
#define IOD_SYM(name) iod_define_symbol(name, _##name);
#define S(name) s::_##name;
Then use S(test) instead of @test and any files that need these symbols defined could just have IOD_SYM(test) at the top or something. #define IOD_DEFINE_SYMBOL(name) iod_define_symbol(name, _##name)
#define IOD_S(name) s::_##name
#define ZLANG_iod_define (IOD_DEFINE_SYMBOL)
#define ZLANG_iod_s (IOD_S)
And then compiling with `-DZLANG_NS=iod` you can call it like this: // Define symbols
$(define hello)
$(define message)
auto hello_api = make_api(
// The hello world procedure.
$(s hello) = [] () { return D($(s message) = "Hello world."); }
);
Also, ZLang can be supported without a need for a dependency on ZLang. "test"@
could return an object that allows one to write "test"@("hello"!)
The constructors called could, of course, also link that object in a global store.At first glance, it looks like the Silicon dependency microhttpd is somewhat analogous to proxygen. Is the Silicon value-added proposition the extra layers on top such as auto gen of client-side code, etc?
You can use it with microhttpd, or any other network libraries (the current version provides backends to cpp-netlib and mimosa https://github.com/abique/mimosa). Future integration with websocket library is planned.
Don't know much about proxygen but it seems like the goal of the project are similar: Ease the writing of high performance C++ web APIs. However, when reading proxygen echo sample [1], I would say that silicon has a higher level of abstraction.
[1] https://github.com/facebook/proxygen/tree/master/proxygen/ht...
I like the idea of running a light C++ application on a crappy $5/month VPS and squeezing out every last drop of performance, built on top of the idea that modern C++ developers can crank out solutions as fast as Ruby or Python developers. From interviewing and talking to people, I don't think the vast majority of developers really understand how far C++ has come in the last 15 years.
The real PITA with web frameworks is how they interact with the database. Now that C++ has some decent ORMs, an improved feature set, and some strong renewed interest, I think we can make C++ a "web language".
- a sqlite middleware: See the example here: https://github.com/matt-42/silicon#middlewares
- a sqlite ORM middleware: https://github.com/matt-42/silicon/blob/master/silicon/sqlit...
- a generic CRUD implementation (relying on the ORM): https://github.com/matt-42/silicon/blob/master/tests/crud.cc
The mysql, redis, postgresql equivalents will come soon.
My stack heavily relies on pg and the other ORMs performance have been disappointing, I need to use something like this.
This whole library smacks of #define BEGIN { #define END }
Not a huge fan of the preprocessor usage but still very interesting and very cool!
I will add a note in the readme about the preprocessor and how to bypass it.
It can't be a macro, so I assume it's a C++14 feature I'm not aware of.
http://docs.biicode.com/c++/gettingstarted.html
Hope you find it useful.
are there any more docs than the description on Github readme?
I know this sounds very n00b of me, but can I use this as an Api layer for raw data?
I'd love to see more middlewares built around it. I used the 'Tree frog framework' for a while, I felt my work flow was not too efficient due to different api layers.
What do you mean by Api layer for raw data?
For the funding part! I'd love to help, perhaps a good start would be using it inside some solution :)! Been there done that. Either way kudos.
Please don't forget to measure latency - both averages and percentiles :)
Suppose your app consumes a JSON api and it turns out that one or two endpoints constitute most of the server load.
Rewriting one or two endpoints using a lightweight, fast framework can be a great solution, so long as you are already being smart about caching and there aren't other bottlenecks in your architecture.
This actually looks like a really neat project.