News for hackers. Stuff that matters.
Re:Why we rewrote Lua in JS (2017) by yiransheng on Monday April 02, 2018 @03:13AM (#16732881)
The list of niceties of lua from the article:

> First class functions and closures

> A versatile data structure: the table

> Vararg expressions

> Lexical scoping

> Iterators

> Coroutines (see below)

Well, looking at modern day js:

* First class functions and closures, check

* the table: a combination of `Array`, `Map` and `Map<Number, T>` can prettify much cover typical usecases of lua tables, so js is close in this regard

* Vararg expressions, check

* Lexical scoping, check

* Iterators, check

* Coroutines, with libraries and abstractions on top of generator functions

In addition, in js land, other paradigms of concurrency exists, such as CSP (goroutines), FRP (Rxjs and co). Of course, these can be implemented in Lua as well, but the libraries may not quite as battle-tested.

The author also mentions a sane coercion system; this still true, but ever since "use strict", unexpected coercions can mostly be avoided in js.

On the other hand, js has:

1. Typescript and static typing (a bit unfair to consider this js, but ts gets access to a large portion of high quality npm packages), flow is also great

2. Multiple mature echosystems of UI frameworks (React) - for instance if you need a date picker or an autocompleter, it's just `yarn add` away; I doubt enough such libraries exist for browser side lua yet

3. Tooling support - webpack, prettier, postcss and so on

I like lua, but I feel it does not offer much in addition to what modern js already provides. Of course bring more languages to the browser is always a good thing, on the other hand I do feel this is a tough sell to the larger community.

Re:Why we rewrote Lua in JS (2017) by giann on Monday April 02, 2018 @03:19AM (#16732904)
I think you misunderstand the aim of the article. It’s not a case and point against js but for Lua in the browser. When I list positive points of Lua, I’m not implying they don’t exist in JS.
Re:Why we rewrote Lua in JS (2017) by Dylan16807 on Monday April 02, 2018 @06:42AM (#16733536)
Javascript generators make for painful coroutines, because a function called by the generator can't yield all the way out.
Re:Why we rewrote Lua in JS (2017) by yuchi on Monday April 02, 2018 @08:43AM (#16734006)
Yield * fn()?
Re:Why we rewrote Lua in JS (2017) by Dylan16807 on Monday April 02, 2018 @03:52PM (#16738599)
You can use that sometimes, but it really complicates return values in a way Lua just doesn't have to deal with.