News for hackers. Stuff that matters.
Re:Concurrent JavaScript: It can work by pitaj on Wednesday August 30, 2017 @02:16PM (#15134571)
I share your concerns about the usefulness and implementation of this concurrency strategy.

In my opinion, concurrency isn't necessary for JS. If web developers want high-performance, concurrent computing, they should push for adding concurrency to WASM.

I doubt concurrency could hurt JS, but I just don't see any reason for it that concurrent WASM doesn't fulfill.

Re:Concurrent JavaScript: It can work by stupidcar on Wednesday August 30, 2017 @02:20PM (#15134607)
And what about server developers using Node.js?
Re:Concurrent JavaScript: It can work by thehardsphere on Wednesday August 30, 2017 @03:10PM (#15134998)
I thought the point of Node.js was that threads were too complicated and rendered unnecessary by asynchronous event loops that do message passing between processes. Are the Node people finally giving up on this trope?
Re:Concurrent JavaScript: It can work by fermuch on Wednesday August 30, 2017 @02:39PM (#15134745)
Is there any limitation or reason for not implementing WASM on nodejs?
Re:Concurrent JavaScript: It can work by stupidcar on Wednesday August 30, 2017 @02:53PM (#15134864)
Of course not, and hopefully it will come to V8, but its mere existence does not preclude enhancing JavaScript, any more than the existence of PInvoke or JNI precludes enhancing .NET and Java.

When people say "JS shouldn't support feature X", when feature X is supported in every other serious language, I can't help but guess that their real problem is with JS itself, and they just don't think people should be using it at all. Fine, if that's their opinion, but they should come right out and say it.

Re:Concurrent JavaScript: It can work by chrisco255 on Wednesday August 30, 2017 @04:14PM (#15135592)
Well for me it adds complexity to JS. One nice thing about JS is that it is single threaded and you don't have to deal with locks or inconsistencies there. An entire class of problems goes away, and since JS event loop is reasonably fast as it is, it's pretty nice not having to worry about concurrency.
Re:Concurrent JavaScript: It can work by threatofrain on Wednesday August 30, 2017 @09:23PM (#15137446)
I would think that it's owing to the frequently single-threaded context of JS that concurrency becomes even more vital for maintaining the liveliness of your app. I also think that identifying aspects of concurrency often means free parallelism speedups, and the user doesn't even have to be aware -- no extra mental price.
Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @02:58PM (#15134921)
So true!

Lots of people actually like using JS. I think it makes sense to understand what features can be added to this language.

Re:Concurrent JavaScript: It can work by jensvdh on Wednesday August 30, 2017 @04:25PM (#15135682)
What's the point? Why not write your server directly in say Python or Java then?

I thought WASM is meant to get around the restriction that the browser only understands JS right now.

Re:Concurrent JavaScript: It can work by pitaj on Wednesday August 30, 2017 @06:08PM (#15136514)
> why not use X

Because X doesn't run in a browser

Re:Concurrent JavaScript: It can work by kornakiewicz on Wednesday August 30, 2017 @06:21PM (#15136605)
Do you need to run your server in a browser?
Re:Concurrent JavaScript: It can work by geldan on Wednesday August 30, 2017 @07:07PM (#15136877)
No, but it's very nice to be able to share code for things like view rendering or form validation between the server and client without jumping through hoops.
Re:Concurrent JavaScript: It can work by shurcooL on Wednesday August 30, 2017 @10:32PM (#15137764)
So you use language X. Compile it and run it natively on server, compile it to wasm and run that in the browser.
Re:Concurrent JavaScript: It can work by chr1 on Thursday August 31, 2017 @07:11AM (#15139494)
Why should i use language X that i don't like, instead of nice dynamic language, without compilation step that i like, and which only misses this tiny feature?
Re:Concurrent JavaScript: It can work by thehardsphere on Wednesday August 30, 2017 @03:14PM (#15135033)
There may or may not be, but that doesn't address that Node.js was created to specifically avoid a threaded concurrency model in the first place.
Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @02:41PM (#15134770)
Is there any limitation of reason for forcing people to rewrite their Node.js apps in something else just to get modern features?
Re:Concurrent JavaScript: It can work by gcb0 on Wednesday August 30, 2017 @08:12PM (#15137189)
in this case, yes, a feature that breaks backward compatibility.

So someone suggested rewriting in another language, since the new feature will not fit the only advantage nodejs have: same language as browser. The alternative is to rewrite in a type of JS that will not run on the browser either.

Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @09:09PM (#15137401)
Te proposal for concurrency in the post does not break backward compatibility.
Re:Concurrent JavaScript: It can work by Ajedi32 on Wednesday August 30, 2017 @03:13PM (#15135027)
No. In fact, AFAIK it's already implemented on Node, behind the --expose-wasm flag: http://thecodebarbarian.com/getting-started-with-webassembly...
Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @02:37PM (#15134738)
Right! It can't be the all of the cool features are done in wasm, which doesn't even have a GC yet.
Re:Concurrent JavaScript: It can work by vlunkr on Wednesday August 30, 2017 @02:55PM (#15134888)
WASM is farther along than concurrent JS though...
Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @03:11PM (#15135007)
That's true. But most of the web is written in JS, not wasm.
Re:Concurrent JavaScript: It can work by api on Wednesday August 30, 2017 @07:19PM (#15136933)
If you have crazy high performance stuff you can do it in native modules.
Re:Concurrent JavaScript: It can work by rmrfrmrf on Wednesday August 30, 2017 @02:46PM (#15134806)
Depends on what you're doing, but if you just want to take advantage of multiple cores you can already accomplish that with `cluster`.
Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @02:57PM (#15134913)
I remember when people used to say "you don't need threads, just use fork"!
Re:Concurrent JavaScript: It can work by rmrfrmrf on Wednesday August 30, 2017 @03:26PM (#15135132)
What do they say now, out of curiosity?
Re:Concurrent JavaScript: It can work by pizlonator on Wednesday August 30, 2017 @09:11PM (#15137407)
Now they say use fork-join. ;-)

Point is, some people don’t like threads and probably never will. Other people like threads and probably always will. Some languages have threads and many other programming models and then everyone is happy. I want the people who like threads to be happy in JS.

Re:Concurrent JavaScript: It can work by mschuetz on Thursday August 31, 2017 @03:18AM (#15138714)
I need concurrency to parse and prepare streamed 3D data while keeping the main javascript/render thread fast. WebWorkers are already very useful in that regard.
Re:Concurrent JavaScript: It can work by emeryberger on Thursday August 31, 2017 @12:02PM (#15141234)
Obligatory plug for Browsix (http://browsix.org), "Unix in your browser", which already provides concurrency via Unix-like processes and IPC. Processes can communicate with sockets & pipes, and run on separate WebWorkers. (Also, you can directly run complex C/C++ applications that expect a Unix environment.)