r/cpp • u/kindredseer • Sep 18 '26
Embedded C++
Just curious how useful the ability to embed C++ as a scripting language into your C++ programs would be? I mean like runtime JIT execution of C++ code in much the same way you might embed Lua, including the ability to restrict/sandbox it as necessary.
6
Upvotes
View all comments
Show parent comment
9
u/TeraFlint Sep 19 '26
Because C++ has been designed to be compiled and be aggressively statically optimized by said compiler. This has brought in a lot of design decisions that made the language more complex (and arguably more difficult to handle).
If you're in interpretation land, a lot of these optimizations don't hold. And once that's the case, I don't see why we should stay with such a complex language other than for familiarity. Something simple with less foot guns would be the more sane choice for scripting.