News for hackers. Stuff that matters.
Re:Farewell Node.js by aikah on Friday July 04, 2014 @04:28AM (#7987856)
Nodejs could have workers,it's not really a javascript.Node maintainers just didnt implement that stuff.

I personnally dont like generators for concurrency.It's the wrong solution to the problem.For now I stick with promises,and I hope JS gets async/await keywords quickly.

Re:Farewell Node.js by throwaway41597 on Friday July 04, 2014 @07:09AM (#7988235)
> Nodejs could have workers

Agreed, but what I meant is that the API (running a file in a worker) is inconvenient, first because there is no closure. Go allows the go routine to read variables in scope and has a race detector to tell you when your accesses are unsafe. There's also the issue of managing workers: is a web worker an OS thread or a light thread [1]? how many can you spawn? which worker should you send work to? These problems are solved by Go. I think it would be very hard to obtain the same reliably and performance with today's web workers. Other languages solve this with a language construct, not an API to run another file.

> I hope JS gets async/await keywords quickly

It would be a step up. But most of the time you want to express a linear list of tasks. Javascript should support this by having a synchronous variant of its APIs and having light threads.

My hope is more that some language having such features will compile to asm.js

[1]: it's either a thread, a process or an "equivalent construct" http://dev.w3.org/html5/workers/#processing-model