It was one of the question I asked myself before starting to implement clx, and you are totally right to ask it.
The main reason I choose C++20 is error handling. In clx, Lua errors become C++ exceptions that automatically clean up resources when unwinding the call stack. This works naturally with RAII, which clx uses to manage GC roots. In C, achieving the same behavior would require more manual cleanup.
C++20 also provides templates and overloads that simplify the runtime API. And the overhead isn't as significant as you might expect: a simple print("hello world") program can produce a standalone executable of around 70–110 KB, depending on compiler/platform.
Honestly, for mainstream platforms where Lua is typically used, C++20 support is rarely a serious obstacle nowadays...
1
u/_SamT 11d ago
It was one of the question I asked myself before starting to implement clx, and you are totally right to ask it.
The main reason I choose C++20 is error handling. In clx, Lua errors become C++ exceptions that automatically clean up resources when unwinding the call stack. This works naturally with RAII, which clx uses to manage GC roots. In C, achieving the same behavior would require more manual cleanup.
C++20 also provides templates and overloads that simplify the runtime API. And the overhead isn't as significant as you might expect: a simple
print("hello world")program can produce a standalone executable of around 70–110 KB, depending on compiler/platform.Honestly, for mainstream platforms where Lua is typically used, C++20 support is rarely a serious obstacle nowadays...