3 ms·
Let me attempt to clarify a few things with fresh eyes: Javascript doesn't have threads, so true coroutines not really possible (w/o webworkers). If you lock u
by matthewmueller 9y ago
Let me attempt to clarify a few things with fresh eyes:
Javascript doesn't have threads, so true coroutines not really possible (w/o webworkers). If you lock up the event loop in one of Joy's goroutines, the other's won't proceed.
This limitation doesn't mean that we can't use the CSP concurrency model in an awesome way in Javascript. If you search NPM for csp or channel, you'll find some good examples.
For the Go programs I've come across using goroutines, calling an async function like this (async () => {})() is a good enough approximation for frontend development.
You may lose out on true parallelism and better error handling, but that's the JS environment we're targeting.
- sAbakumoff 9y agoThe only problem is co-rotines are not really useful in the fat client SPA's. They are all about data flow and event handling.
- boomlinde 9y ago> Javascript doesn't have threads, so true coroutines not really possible (w/o webworkers). A coroutine is not a thread and an implementation of coroutines does not (necessarily) depend on threads. Goroutines can also run on a single thread.