Criticism of JavaScript callbacks
April 2, 2013
I read two interesting articles about the shortcomings of JavaScript callbacks. I played a bit with node.js and I find that the use of callbacks makes the code more convoluted that it could be.
- Joe Armstrong compares use of callbacks in Erlang and JavaScript
- A nice introduction to promises in JavaScript and how they could untangle callback hell (especially in node.js)
I find Erlang's mailbox approach simpler to understand and read (but I can not warm up to Erlang syntax...).
Promises looks... promising but I'd like to try them out on a pet project to get a better feel on them. In France, we have a saying that said that "promises bind only whose that listen to them", so I prefer to be cautious :)