3 ms·
Coroutines, and Lua's metatables are more powerful than what can be done in ES5 (ES6 closes the gap a bit, and generators are equivalent to coroutines). Lua is
by plorkyeran 13y ago
Coroutines, and Lua's metatables are more powerful than what can be done in ES5 (ES6 closes the gap a bit, and generators are equivalent to coroutines).
Lua is pretty much JS done right, which actually makes it a poor choice for something like this IMO. A program written in Lua is not going to be fundamentally different from the same program written in JS, and the problems introduced by using this (worse debugging experience etc.) are very likely to outweigh the benefits of avoiding JS's warts.
- stcredzero 13y ago(worse debugging experience etc.) How do you know? Maybe try this first? Apparently, there is a in-browser debugger you can activate just by including two files. This is theoretically a first-class debugger that doesn't even need source maps. http://moonshinejs.org/how-to/debug-locally/ http://moonshinejs.org/how-to/debug-locally/ Were you assuming that Moonshine is a compiler targeting Javascript? It's actually a Lua bytecode VM.
- anonymoushn 13y agoGenerators are equivalent to corourintes only as long as every single function you write is a generator and every single function call (to one of your own funcitons, anyway) is actually delegating to another generator. You can use a trampoline to make this less painful, but then you don't get to see your "real" call stack in the debugger...
- Tanner 13y agoFrom my cursory evaluation, the debugging support is actually better than vanilla Lua. The only point of friction I can see if that you have to "compile" something that is normally interpreted.
- paulcuth 13y agoThis is true. However the distiller can --watch a directory and do this step for you in the background. For more info: $ moonshine help distil