from Hacker News

Ravi is a dialect of Lua, with JIT and AOT compilers

by InitEnabler on 3/18/24, 3:54 PM with 15 comments

  • by uticus on 3/18/24, 9:32 PM

    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.

  • by vitiral on 3/19/24, 3:32 AM

    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?

  • by synergy20 on 3/18/24, 9:00 PM

    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

  • by ArkimPhiri on 3/18/24, 9:29 PM

    Ravi is interesting to work with. It's simplicity is was draws me the most.
  • by logtempo on 3/19/24, 12:09 AM

    noob question from a hardware guy : what is a small embeddable dynamic language? What would be a user-case for example?