4 ms·
Show HN: Glua, a Full-Featured Lua VM for Nodejs and the Browser
- jlebrech 10y agoI'd love to see a framework that treats client/server code as Ring 4 and Ring 5. you just have one codebase for client and server and it's up to the programmer to decide what it can trust the client side to compute.
- warpech 10y agoWhat's the context for "Ring 4" and "Ring 5"? Are these some multitier architecture terms?
- warpech 10y agoI suppose it has to do with https://en.wikipedia.org/wiki/Protection_ring https://en.wikipedia.org/wiki/Protection_ring
- oblio 10y agoI find it kind of a funny that over-engineering lost, same as in OSI versus TCP/IP. 7 layers vs 4, 4 rings available vs 2 rings actually used.
- Elves 10y agoFunny, but the lesson is never learnt until late in life. To paraphrase Aristotle: "Only achieve that which is sufficient". Ironic that Lua was designed to be as simple as possible and no simpler (was that Einstein?) and then it gets layered (laid, layed?) over ponderous systems that it really should be replacing. And finally, complying with the rule of three and layering (pun) upon dijkstra's proposition: "layers should be considered evil". Personally, in software, everything should be compiled to machine code if not already written in it, optimised to remove function calls and loops and at run time ensure that all data fetches control movements use the nearest memory.
- icebraining 10y agoThe idea is interesting, but I doubt it'd be actually useful. If you're running code that doesn't require access to specific browser features, why run it on the client at all? It's generally less reliable, often slower, incurs serialization costs, etc.
- daliwali 10y agoThis seems to be a thin wrapper for the actual Lua VM implemented in Go: https://github.com/yuin/gopher-lua https://github.com/yuin/gopher-lua
- swah 10y agoSo Lua to Go, and Go to Javascript. I wonder how well that works..
- russellsprouts 10y agoWell, the original Lua VM is written in C, so it's more like C to Go to JavaScript.
- shinymark 10y agoThis description made me chuckle. It reads to me like someone was intentionally concocting the most complex and least efficient method of programming a computer. I come from a game development background and my view on things is admittedly affected by having to deal with issues related to real time efficiency.
- make3 10y agoHas this been tried with emscripten and regular Lua?
- shakna 10y agoYes [0] [0] https://news.ycombinator.com/item?id=5794772 https://news.ycombinator.com/item?id=5794772 | http://mozakai.blogspot.com.au/2013/05/lua-in-javascript-running-vm-in-vm.html http://mozakai.blogspot.com.au/2013/05/lua-in-javascript-run...
- fiatjaf 10y agoYes: https://daurnimator.github.io/lua.vm.js/lua.vm.js.html https://daurnimator.github.io/lua.vm.js/lua.vm.js.html
- etiene 10y agoReally cool! Reminds me of another awesome Lua->JS project called starlight: http://starlight.paulcuth.me.uk http://starlight.paulcuth.me.uk
- giann 10y agoThis suffers from the same issue as https://daurnimator.github.io/lua.vm.js/lua.vm.js.html https://daurnimator.github.io/lua.vm.js/lua.vm.js.html and others: there is 2 GC working side by side and it's bound to lead to never freed objects.
- CryZe 10y agoThis isn't just because of 2 GC's working side by side. This happens to any memory that isn't a JavaScript object. So every asm.js and WebAssembly library is affected by the same issue, even if it doesn't have its own garbage collector. With there no way of hooking into JavaScript's Garbage Collector, you can't free your native handles when the JavaScript object wrapper gets collected, so you get leaks all over the place. So the only option is to manually manage your JavaScript objects in your JavaScript code by calling their "destructors", which kind of defeats the whole purpose of having a Garbage Collector. With WebAssembly on the rise, I hope people become more aware of this issue and implement proper GC Hooks for JavaScript.
- NiLSPACE 10y agoThere is also one in WebAssembly: https://github.com/vvanders/wasm_lua https://github.com/vvanders/wasm_lua