> Lua uses the setjmp facility from C, which results in a mechanism similar to exception handling. (If you compile Lua with C++, it is not difficult to change the code so that it uses real exceptions instead.)
In fact, it already uses exceptions when compiled with C++ compiler.
If Lua is compiled with C, setjmp interferes with exceptions in C++ programs which embed Lua, by "forgetting" to unwind stack and call destructors, resulting in leaks.
I don't know if USE=cxx would be enough: how does a C program which embeds Lua handle C++ exceptions which C++ Lua would throw?
Maybe existing slots need to be duplicated? E.g. have slots such as these: 5.1, 5.1cxx, 5.3, 5.3cxx, which would need to be integrated with LUA_COMPAT in some way
If to just unconditionally use C++ always for it, at minimum this would require switching C programs which use lua, to also use C++ linker and handle mangled names of lua functions
CCing Marecki in case he has thoughts on it as the architect of the Lua eclasses
CCing ConiKost as one of the main Lua-wranglers in ::gentoo.
Not a fan of very nearly doubling the number of Lua targets by using separate variants for C and C++. That said, as long as the C versions remain the default (Lua is C software which just happens to have certain special properties when compiled as C++) it is up to dev-lang/lua maintainers to decide if/how they want to hack this into being.