Re:JavaScript Promises: There and back again
by empthought on Wednesday December 18, 2013 @04:47PM
(#6931079)
Sure, but you always opt-in to using variables that are scoped outside of the current thread. You don't opt-in to the explicit control operators encouraged by the style where you don't use sequential statements -- they are required in order to program correctly. This is why I think the goto analogy is appropriate.
Still, scheduling would continue to be cooperative via yield (just split amongst multiple threads). Go is clearly much further ahead in that regard :D
[1]: https://groups.google.com/forum/#!topic/golang-nuts/hZjvk-EP...
note: I'm curious, doesn't shared state from those closures let you shoot yourself in the foot in Go? You still have to be careful not to use anything not thread-safe that can potentially change...