Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Now the only thing Lua has on JS, implementation-wise, is an implementation that is very small/embeddable and very fast (LuaJIT).

Well, and a simpler, more regular syntax. Simpler semantics. Real coroutines. Tail call elimination. Multiple returns. Better iteration syntax and protocol. Better lexical scope. Operator overloading. A well-established FFI. No weird variable hoisting, nasty implicit conversions, semicolon insertion, etc.

But, sure, aside from those things, Lua doesn't have anything on JS as a language. (Of course, as an ecosystem, JS is miles ahead.)



Your parent explicitly stated that he's talking about JS implementations and not about the language. All you've said may be true, but it's completely off-topic and has no relation to the parent post at all.

EDIT: typos.


Still interesting to people not knowing the other advantages Lua has. Might get some interested in the language.

Not everything has to be strictly on-topic to have merit, especially since we've already derived from the topic (from a specific embeddable JS engine to the comparative merits, implementation wise, of JS vs Lua).


Those are all very important comparisons (and I would add that both Lua and JS got the global by default thing wrong0. I would note that ES6 requires proper tail calls and that trampolining can accomplish tail call elimination (tail call elimination is different than proper tail calls).

The major issue to me is time. I know quite a few languages, but have only mastered a couple. JS is everywhere and the browser makes sure this will be the case for a long time.

The issue is that these advantages do not outweigh the ubiquitous nature of JavaScript. If I already need to learn all of those JS quirks, why learn Lua too?


I still think that https://love2d.org/ is one of the easiest, most fun and rewarding ways of stepping into game programming (especially when compared with the currently existing JS Game Dev Frameworks).


because learning isn't something you stop doing?

Also, lua is a nicer language, and if you have the choice, you should chose it over js.


> Also, lua is a nicer language, and if you have the choice, you should chose it over js.

Sorry, but I prefer the nasty language with 0-indexed arrays.


The issue is that these advantages do not outweigh the ubiquitous nature of JavaScript. If I already need to learn all of those JS quirks, why learn Lua too?

In my case, because Awesome is a nice window manager.


Quite true.

Although on this theory, I should really have learned some Haskell by now. And yet. Every trip to the xmonadrc is a fresh glimpse at the depths of my own ignorance.


> (tail call elimination is different than proper tail calls).

I'm not sure I follow. What is the distinction here?


> as a language

I said "implementation-wise" (it's even in the snippet you quoted).


Oh, snap. My reading comprehension = bad. Sorry. :(


I wanted to reply exactly that but then noticed that op is talking about implementations, not the language itself.

I'd still prefer programming in lua to programming in javascript where possible. Honestly, the only advantage of javascript outside the browser are the hordes of people who already sort-of know it (and often don't want to learn anything else).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: