6 ms·
It's sad to see lua get slowly replaced by javascript.
by placeybordeaux 11y ago
It's sad to see lua get slowly replaced by javascript.
- ianlevesque 11y agoIt is. But JavaScript is the new assembly language, all you need is a Lua to JS compiler or a whatever to JS compiler.
- teacup50 11y agoI genuinely can't tell whether you're joking.
- ianlevesque 11y agoNot joking, just dying a little inside.
- hackcasual 11y agohttps://kripken.github.io/lua.vm.js/lua.vm.js.html https://kripken.github.io/lua.vm.js/lua.vm.js.html
- vardump 11y agoLast I checked Javascript implementations were slower than LuaJIT. Cost of implementing Lua tables, meta-tables, co-routines, etc. in Javascript will be rather high. Anywhere between 2-50x. If native Lua engine is removed, you can just forget about it then. So what you're saying doesn't make any sense for anything remotely performance sensitive.
- bryanlarsen 11y agolua compiled to asm.js is 64% of the speed of lua native https://kripken.github.io/lua.vm.js/lua.vm.js.html https://kripken.github.io/lua.vm.js/lua.vm.js.html
- pygy_ 11y ago... which is about 10 times slower than the LuaJIT compiler used by OpenResty.
- Touche 11y agoSo that might be good enough in the browser but on the server where an optimized Lua engine exists, why?
- daurnimator 11y agoThat's not compiling lua to asm.js; it's running the lua vm in asm.js. A straight up transpilation is other projects like lua.js. But you loose really nice core lua features like coroutines...
- striking 11y agoIt's a joke. Like haha, but serious, because some people actually believe this.
- kybernetikos 11y ago> Cost of implementing Lua tables, meta-tables Tables and meta tables are nearly identical to objects and prototypes in javascript. Why would the cost of implementing them be high?
- fanf2 11y agoJavaScript objects are indexed by strings. Lua tables are indexed by arbitrary objects. In JS a[1] and a["1"] are the same element but they are different in Lua. In Lua a[{}] is a new element indexed by the identity of the new object literal, and will be a different element every time the expression is evaluated.
- kawsper 11y agoI have been playing around with Lua in Openresty for the last few nights. I haven't had any Lua experience before but it seems to be a good language for Nginx, and it has been fun to learn.
- aikah 11y agoWell, it's a popularity contest. Lua is certainly a great language, it's fast and it works well with C. I guess that nginx team thinks that js will bring more users therefore more business. If I were to develop a product and add a scriptable layer, i'd certainly use JavaScript. Even if it is not the best language out there, it's about growing an ecosystem.
- placeybordeaux 11y agoEcosystem isn't the only thing to think about, but I agree that is almost certainly why they chose js.
- romaniv 11y agoI'm willing to bet it won't bring them any new business. And in the long run, it will encourage their existing users to dump nginx and use Node.
- sangnoir 11y agoIsn't Node more of an Application server though? I don't see Node replacing Nginx in the roles it's normally used for (serving static resources, reverse-proxy). I can't think of a single upside
- tracker1 11y agoAgreed... I don't want the effort and complexity it would take to offer a lot of what's pretty easy with nginx inside a node app. As much as I really like node, I think it's generally nginx in front of node to offset what it does better... I think people make applications complicated enough as it is...
- coldtea 11y agoIf you think people will dump nginx for Node (which has totally different use cases) then I'm not sure how qualified the business estimation is...
- TazeTSchnitzel 11y agoLua and JavaScript are very similar languages and share the basic problems. I'm indifferent.
- jbverschoor 11y agoExactly.
- Touche 11y agoI like and use both. I think Lua is a better language and I have a hard time seeing otherwise. Lua has some warts too, it's not about warts, but Lua got enough right from the beginning, is small enough to be crazy fast, and is not continually adding new large features. This is the key thing to me. JavaScript is designed by committee and has too many features in ES6.
- TazeTSchnitzel 11y agoThat's a good point, Lua is smaller than JS. It does have that going for it.
- ThinkBeat 11y agoI think is is sad to see anything replaced by Javascript. Unpopular opinion I guess. So many better choices out there.
- accounthere 11y agoI for one like seeing Javascript replaced by better Javascript.
- deleted 11y ago[deleted]
- Maarten88 11y agoBetter javascript would be incompatible with javascript - best you can get will be "less sucking javascript". And you'll be able to use it somewhere in the far future, after four competing companies have implemented enough of it in a way that mostly works, their browsers have reached most of the internet and the brave open source community has developed the polyfills needed to fix the incompatibilities. I'm not holding my breath. Javascript sucks, it will be everywhere and we are stuck with it.
- romaniv 11y ago> So many better choices out there. For now. I get the feeling that soon enough a lot of them will start dying out. Trying to "sell" some language other than JS in a mostly-JS shop is already an impossible battle. Popularity is used as a counter-argument for everything.
- spinlock 11y agoI was just thinking that the Javascript community saw that the Ruby community were both snobs and well respected, assumed a causal link, and thought they just needed to be snobs for people to respect Javascript.
- lohengramm 11y agoBy better choices you mean better languages or other methods of achieving the same flexibility without the complexity of a language like JS? Can you reply with examples? I am interested in alternatives to JS and LUA.
- Aldo_MX 11y agoI have tried so hard to like Lua, but I prefer 0-indexed arrays and curly braces.