Love it. Use case is difficult to grasp at first, but seems to be somewhere less powerful than LuaJIT, but with typing; and more powerful than Typed Lua, but with the same typing?
Lua is perfect as a small embeddable dynamic language so why a derivative? Ravi extends Lua with static typing for improved performance when JIT compilation is enabled.
There are other attempts to add static typing to Lua - e.g. Typed Lua but these efforts are mostly about adding static type checks in the language while leaving the VM unmodified.
Of course there is the fantastic LuaJIT implementation. Ravi has a different goal compared to LuaJIT. Ravi prioritizes ease of maintenance and support, language safety, and compatibility with Lua 5.3, over maximum performance.
Lua only has 5 "data" types: nil, bool, number, string, and table. There is also "userdata" (defined in C)
Would this improve performance for functions that take in the non-table types? Or does it provide some mechanism for structured data besides tables?
I have a hard time believing there are many performance gains to be had for the few functions that take in only native types. I suppose compiling those could have major performance improvements in a few tight-loop use-cases?
The C Lua interpreter takes ~150k. It's easy to extend with your own types/functions. So it makes it easy to use as a Turing complete configuration language
Over the last couple weeks I've been integrating gopher-lua (a Lua implementation in Go, which then plays nice with Go types & its GC) into PeerDB for scripting data transformations. It's been easy expose stuff like decimal types to the script. It allows a program to make itself extensible
Automation. It can be used to automate tasks in an app. For example, a common task in a Photo Editor app is to resize photos. But resizing 100's of photos manually can be a pain. If the app has scripting support, you can write a script to resize photos and just run it. It can also be used to add the feature of creating extensions / add-ons for an app. (See https://www.gnu.org/software/guile/ ).
Lua can certainly work, though it takes up a bit more ram than absolutely necessary due to it allocating language data structures (tables mainly) during startup. If you have enough ram it is fine. I ported Lua to the RIOT OS and it was not all that hard.
Comments
Love it. Use case is difficult to grasp at first, but seems to be somewhere less powerful than LuaJIT, but with typing; and more powerful than Typed Lua, but with the same typing?
Love it but don't quite get it.
Lua only has 5 "data" types: nil, bool, number, string, and table. There is also "userdata" (defined in C)
Would this improve performance for functions that take in the non-table types? Or does it provide some mechanism for structured data besides tables?
I have a hard time believing there are many performance gains to be had for the few functions that take in only native types. I suppose compiling those could have major performance improvements in a few tight-loop use-cases?
You forgot in Lua 5.3+ "integer". (there's also "thread" for coroutines and "function", but those aren't "data" types)
Integer is a good point. I just learned about math.type in 5.3!
it's based off MIR, does it have something to do with https://mlir.llvm.org/ ?
for typed lua, there is a newer typescript-alike effort https://github.com/teal-language/tl than the mentioned one at https://github.com/andremm/typedlua
MIR comes from the Rubyverse and isn't related to LLVM MLIR.
https://github.com/vnmakarov/mir?tab=readme-ov-file#mir
Ravi is interesting to work with. It's simplicity is was draws me the most.
noob question from a hardware guy : what is a small embeddable dynamic language? What would be a user-case for example?
"small embeddable dynamic languages" are usually used to configure or program other larger compiled applications. This is bes understood by example:
https://create.roblox.com/docs/tutorials/scripting/basic-scr... - make a mini game in Roblox
https://github.com/openresty/lua-nginx-module?tab=readme-ov-... - configure and extend NGINX
https://wezfurlong.org/wezterm/config/lua/general.html - make your terminal more useful (my personal config changes the tab color based on the process name - https://github.com/bbkane/dotfiles/blob/master/wezterm/dot-c...
https://m.youtube.com/watch?v=MQBr9hwf0BY - configure your text editor
ho I see. It's kind of a programming interface, a "higher level" language, a plug-in.
for exemple, GdScript in Godot game engine would fall into the "embedded dynamic language" ?
Yes I think so- it manipulates and orchestrates the compiled C++ code underneath.
The C Lua interpreter takes ~150k. It's easy to extend with your own types/functions. So it makes it easy to use as a Turing complete configuration language
redis exposes a Lua scripting interface if one wants to avoid latency of executing commands back & forth over network: https://redis.io/docs/interact/programmability/eval-intro
Over the last couple weeks I've been integrating gopher-lua (a Lua implementation in Go, which then plays nice with Go types & its GC) into PeerDB for scripting data transformations. It's been easy expose stuff like decimal types to the script. It allows a program to make itself extensible
A hardware guy might appreciate
https://github.com/snabbco/snabb
https://blogs.igalia.com/dpino/2017/11/13/snabb-network-tool...
Automation. It can be used to automate tasks in an app. For example, a common task in a Photo Editor app is to resize photos. But resizing 100's of photos manually can be a pain. If the app has scripting support, you can write a script to resize photos and just run it. It can also be used to add the feature of creating extensions / add-ons for an app. (See https://www.gnu.org/software/guile/ ).
Lua can certainly work, though it takes up a bit more ram than absolutely necessary due to it allocating language data structures (tables mainly) during startup. If you have enough ram it is fine. I ported Lua to the RIOT OS and it was not all that hard.