4 ms·
I find goroutines and channels much easier to work with than promises, callbacks, or async/await, and the former can parallelize computation as well. Not to men
by weberc2 8y ago
I find goroutines and channels much easier to work with than promises, callbacks, or async/await, and the former can parallelize computation as well. Not to mention that Go is typically faster than Node in single-threaded execution.
- mikekchar 8y agoYou can easily implement channels in ES6. I've done it and my implementation is probably 40-50 lines of code. You can then use async/await to simulate go routines. It's actually a bit nicer than go because of the way async coordinates with promises. You can more easily synchronise the routines (for example in situations where you might need a wait group in go). I keep expecting someone to write one and put it up on NPM (I haven't looked recently, though). Perhaps I should clean up my and stick it up there. It provides a very nice abstraction of continuations. I did it merely as kata to show that continuations do not require concurrency.
- deleted 8y ago[deleted]
- spiralx 8y agoI've read a few articles on implementing CSP in JavaScript, and there are definitely some packages available, e.g. https://github.com/olahol/node-csp https://github.com/olahol/node-csp https://github.com/ubolonton/js-csp https://github.com/ubolonton/js-csp https://github.com/gozala/channel https://github.com/gozala/channel