|
It seems like creating a Cython clone for Lua might be a good idea. Maybe someone is already doing this?
Pallene/Titan[1] are being developed in a related space. They let you write extension modules in a language that is close to to Lua, but much faster. You can also define custom low-level struct-like data-types (built on top of userdata). The compiler produces the required Lua bindings and makes sure that garbage collection does the right thing.
The main differences between Pallene/Titan and Cython are that Cython is a superset of Python, while Pallene/Titan is closer to a typed subset of Lua. Additionally, the Pallene compiler can optimize some code that uses Lua tables, as long as it has the appropriate type annotations. With Cython only the parts of the program that use the "C types" are optimized.
So it seems that writing a C/C++ binding for Python is actually less
effort than writing one for Lua. This is definitely one of our goals with the project as well :) [1] https://github.com/pallene-lang/pallene - Hugo