3 ms·
I once considered Wren for a situation where I (to a first approximation) wanted to allow users to write 'plugins' that link against my internal C application s
by pcfwik 11mo ago
I once considered Wren for a situation where I (to a first approximation) wanted to allow users to write 'plugins' that link against my internal C application symbols but using a language focusing more on ease of use (rather than C).
Unfortunately, neither Wren nor any of the other major 'embeddable scripting languages' (e.g., Lua) were really a good fit for this, because they commit fully to the 'all-numbers-are-floats' thing and generally don't seem to even try to provide a general equivalent to the C++ `extern "C" { ... }` thing.
Of course, I know this isn't really the target use case of Wren/Lua/etc., but if anyone knows of a good embeddable scripting language for this I'd love to hear about it. Eventually I went with CPython (which provides ctypes to solve my problem) but it's a huge pain to embed properly.
- pansa2 11mo ago> a general equivalent to the C++ `extern "C" { ... }` thing That sounds a lot like what LuaJIT’s FFI provides: https://luajit.org/ext_ffi.html https://luajit.org/ext_ffi.html
- pcfwik 11mo agoOh awesome, thanks for the pointer!
- user____name 11mo agoLua's latest versions have integer support. Luau is a typed variant of Lua used by Roblox.
- 0x0203 11mo agoI find myself referencing this list of embeddable scripting languages pretty frequently: https://github.com/dbohdan/embedded-scripting-languages https://github.com/dbohdan/embedded-scripting-languages Ones that might be of interest to you are Umka, tcl, and berry. There's also a lot of others listed that range from someone's experimental side project to professional grade and well supported languages. Kinda fun to see different people's approaches to things, and no matter what your preferred programming style, there's probably a few in there that will mesh pretty well.
- spooky_deep 11mo agoRoc Lang could be a nice fit. They are very precise about numbers.
- dkersten 11mo agoLuaJIT does provide C-compatible types through its FFI. I generally prefer LuaJIT over normal Lua for this reason. It also makes embedding super trivial as you only need to use the Lua API to bootstrap and call the first Lua function, after that you can just use the FFI which lets you work directly with extern host functions.