Hacker News new | ask | show | jobs
by Zikes 4128 days ago
I would love to see a channel primitive similar to Golang's. They really seem to have hit the nail on the head with that one.
3 comments

The CSP model is very nice, but I don't think that what this proposal is aiming for. CSP is more about concurrency, while the post makes it clear they are looking at parallelism. This is more addressing "things that appear to be single threaded but run faster" like image analysis, for instance.
They're obviously separate concepts, but tangentially related. Even in Go you'll learn that sometimes introducing multithreading to a concurrent application will actually reduce your performance due to reconciliation of context-switching within the application.

Javascript already has its own inherent concurrency, obviously, but it's not outlandish to say that introducing a goroutine/coroutine concept would be a lot more elegant and manageable.

Clojure and ClojureScript have core.async which does a great/better job https://github.com/clojure/core.async/blob/master/examples/w...

There's also a video if you care to watch https://www.youtube.com/watch?v=enwIIGzhahw

Clojure's core.async library works wonders in ClojureScript giving you channel primitives and coroutines.

I've never tried using them across web workers however.