3 ms·
This is not exactly the same as go's concurrency insomuch as Go allows its concurrency to be across multiple threads/processors and as far as I know node runs o
by programminggeek 13y ago
This is not exactly the same as go's concurrency insomuch as Go allows its concurrency to be across multiple threads/processors and as far as I know node runs on a single thread.
- jamesjporter 13y agoSure, but it provides similar concurrency semantics (putting things on and taking things off of channels), which is what I think David is really trying to emphasize.
- malandrew 13y agoDoes that mean that this could pave the way to automatic spawning of web workers or spawning of child processes (via future native language or engine implementation or library)?
- pfraze 13y agoTo a limited capacity. If you're looking for: console.log('this is in the document'); go(function() { console.log('this is in a web worker'); }); I'd recommend against it. Even if you can toString() the function passed to go() and load that into a worker, you'd not carry the function's closure, which I think is too complex. var x = 5; go(function() { console.log('x = '+x); }); // => x = undefined Could be done, but I'd rather stick with paradigms that fit the language more closely.