You write on your homepage: Like Lua, Roc's automatic memory management doesn't require a virtual machine.
How do you mean that? Lua has a traditional GC, and as far as I know, does it need a VM?
From Wikipedia:
Lua programs are not interpreted directly from the textual Lua file, but are compiled into bytecode, which is then run on the Lua virtual machine.
So probably our site is wrong?
oh, I guess so! I always thought Lua didn't have a VM :embarrassed:
what example could we use there instead? :thinking:
swift?
is the most high-level compiled (to machine code) language I can think of
Go also compiles to machine code and has memory management.
yeah I was trying to think of something that people use for "embedding" (like Lua), but maybe there aren't good examples of that :sweat_smile:
So you want embedded and refcounting essentially. Cause GC means VM or interpreter generally speaking (or runtime hooks I guess cause that is what go does, right?).
I guess Go has neither, but it's not really used for embedding (I think maybe because of C ABI and/or maybe it's not a good fit due to being oriented around the use case of servers?)
It has really bad cffi that often is really slow
Gotten better over the years, but historically really bad
But yeah, swift is closest if you ignore the embedding part. Go probably next closest. But neither really good examples
May need to split the example in two. Mention Lua and Swift or something
Nim, Vale, Odin, there are a bunch of languages.
Richard Feldman said:
oh, I guess so! I always thought Lua didn't have a VM :embarrassed:
I think, because there is LuaJIT, and you confused the original Lua because its different from LuaJIT.
Thats at least, how I make such mistakes :sweat_smile:
The text on the homepage still says Lua has no VM:
https://www.roc-lang.org/
I can make a PR, to change this.
Just had a chat with the Nim guys.
They basically use a VM for compile time evaluation, but dont bake it into the runtime.
LuaJIT is still a VM...though VM is a very general term
from https://luajit.org/luajit.html:
For LuaJIT 2.0, the whole VM has been rewritten from the ground up and relentlessly optimized for performance. It combines a high-speed interpreter, written in assembler, with a state-of-the-art JIT compiler.
Also, maybe not super useful here, but happened upon this really good read on the luaJIT VM. All linked to from here: https://0xbigshaq.github.io/2022/08/22/lua-jit-intro/
Definitely a classic VM like JS.
Last updated: Jul 05 2025 at 12:14 UTC