Hacker News new | ask | show | jobs
by zackmorris 4214 days ago
While I think abandoning threading was originally a good move because it spawned (no pun intended) new methods of chaining callbacks together, I'm concerned that there is really no way out of callback hell by way of callbacks.

So I'm wondering if Node.js, Io.js or both will embrace coroutines, yield and generators. The real danger of threads was always shared memory, not so much simultaneous execution. I'm hoping that we'll start to see Go, Erlang and even shell-style piping of data through predictable, testable and debuggable threads of execution begin to replace callbacks.

If anyone has a general approach for converting callbacks to use coroutines and yield in Javascript, I'd be very eager to hear it. Also the problem of how to enforce scope in Javascript, to prevent sharing state between coroutines.

2 comments

If you want to get out of callback hell, I Promise you'll enjoy this library called Bluebird.
`Bluebird` looks good, i gonna try it out. thanks.
Thing is, if you want Go- or Erlang-style piping of data, well, Erlang and Go are right there... and both written from day 1 to support those use cases, rather than bodging them onto a language ten years later....