Hacker News new | past | comments | ask | show | jobs | submit login

please stick with promises. Promises are the only sane way to deal with async in JS. With people starting to use async/await they become even more compelling.

The people who defend callbacks either don't understand the benefits that promises provide, don't know about async/await or are suffering from stockholm syndrome.

Callbacks do not pass the reversibility test. If everyone had started out with promises and / or async/await, and someone proposed callbacks as a way to deal with this instead, they'd be dismissed as a fool. They're an accident of history and we should forget about them as quickly as possible.




Callbacks allow await/defer in Iced CoffeeScript, not to mention the other async libs as stated above.

Promises don't really offer any benefit to program structure overall, generally devs just end up creating long chains of anonymous functions rather than long nests of anonymous functions. Promises actually discourage flat code (and functional programming) for that reason. I understand they seem attractive but become a hack in complex situations.


> Callbacks allow await/defer in Iced CoffeeScript

Not the same thing as in ES6, also that project is totally dead.

> generally devs just end up creating long chains of anonymous functions rather than long nests of anonymous functions

Not true in my experience, also not required at all when using async / await.

> Promises actually discourage flat code (and functional programming) for that reason.

This is really not true, Promises are functional and composable, callbacks are imperative.

> I understand they seem attractive but become a hack in complex situations.

Just no. Callbacks lead to terrible "solutions" like caolan/async, callbacks make refactoring extremely awkward.

Callbacks don't even get to claim better performance, because they require a load of internal hacks in node/io.js to maintain state.

With async/await in the picture, callbacks so totally inferior I can't believe someone would attempt to argue otherwise.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: