3 ms·
I think the reason that "compile to Lua" isn't a more popular option in language development, even though the idea is often brought up, is because a lot of the
by scythe 5y ago
I think the reason that "compile to Lua" isn't a more popular option in language development, even though the idea is often brought up, is because a lot of the "weirdness" of Lua comes from its data structures, or properly, its one data structure and its lookup semantics (__index/__newindex). If you try to build something on top of the core type semantics, you lose Lua's performance; if you modify them, you lose compatibility with other Lua code; if you change nothing, you lack selling points. Over the years, I've written and thrown out two half-baked Lua extensions after hitting this trilemma.
So Yuescript just looks like a polished and cleaned-up Moonscript, which is fine. But the elusive "new language which compiles to Lua" may never materialize, because Lua just isn't all that flexible.
- hunterb123 5y agoI prefer TypeScriptToLua's approach: https://typescripttolua.github.io/ https://typescripttolua.github.io/ The data structures are unchanged, so you have to remember to use base index 1 etc, but you get modern syntax and TS's great inferred typing system. Definitely scales better than raw Lua but you get the perf and compat wherever Lua[jit] is supported. It's nice if you used to use Lua and you use TS as a daily driver, you just have to remember the differences. There's also Teal (https://github.com/teal-language/tl https://github.com/teal-language/tl) but I haven't gotten around to trying it, it may be less confusing to others.
- robbedpeter 5y agoIt's similar to Lisp in this way - what you build out of it is going to be variations on the underlying theme, you might as well just be using Lisp, or Lua in this case, with a specific coding convention and style guide.