I have been using chaiscript, not heavily for now, for a project that must work in iOS/Android.
I wonder if it would be a good idea to make the API constexpr with the following goals:
I want to embed my run-time scripts in the source code itself. This can be done, but they will be executed at run-time.
It would be nice to get a piece of chaiscript code to be optimized, and, through a constexpr
string, be able to manipulate and emit c++ to be run directly, at compile-time.
My questions are:
1.- How difficult it would be to constexpr the evaluation API?
2.- Once constexpr API would be in place, how difficult is to emit C++ source code out of chaiscript source code? I see this is as a very appealing feature (even beyond Chaiscript).
My main use case is to develop and later embed the scripts in the final .exe, but I also wonder if it is worthy to generate code from compile-time strings themselves: this would save the translation to C++ in the case there is something to optimize – Just copy/paste the string, the compiler would do the rest through some metaprogramming.