6 ms·
Came to say the same. The more I think on this problem, the more I'm inclined to say promises aren't solving async well enough, and the only meaningful change w
by pfraze 12y ago
Came to say the same. The more I think on this problem, the more I'm inclined to say promises aren't solving async well enough, and the only meaningful change would be what dale proposes - blocking functions in threads. This is what Bob Nystrom also concludes in a pretty compelling blog post, [1].
Some side notes - silent promise rejection is handled in io.js with the process 'unhandledRejection' event [2]. The difficulty with promises is that they can attach rejection handlers at any time, and so it's impossible to determine whether a rejection will never be handled. That's why the 'await' operator doesn't just throw if it's not inside a try/catch, and it's also why io.js includes the 'rejectionHandled' event [3], in case it turns out 'unhandledRejection' was emitted prematurely. Oh lord.
Also, keep in mind that ES7 is not standardized, so if you use a transpiler to get these new features, you're building on a bed of sand.
1 http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ http://journal.stuffwithstuff.com/2015/02/01/what-color-is-y...
2 https://iojs.org/api/process.html#process_event_unhandledrejection https://iojs.org/api/process.html#process_event_unhandledrej...
3 https://iojs.org/api/process.html#process_event_rejectionhandled https://iojs.org/api/process.html#process_event_rejectionhan...