News for hackers. Stuff that matters.
Re:What's The Point Of Promises? by jschrf on Friday March 29, 2013 @01:18AM (#5459360)
Promises and Deferreds are anti-patterns, in my book. They pollute the call stack and explicitly introduce uncertainty. Why would you want to code against an object representing a thing that may or or may not be complete? Good software strives for determinism. Passing around "maybes" is the opposite of that.

Promises are a poor solution for people not willing to properly model their tasks.

A far better way is to actually think about what you are trying to achieve and stick with a simple sequential control flow, rather than using some sort of overwrought API hammer to bash nails into your codebase everywhere.

Don't nest inline callback functions. When you pass callbacks, pass references to object functions. Model these asynchronous flows as objects. Don't pass around uncertainty. Embrace events.

Re:What's The Point Of Promises? by rtpg on Saturday March 30, 2013 @05:26AM (#5464913)
All your criticisms can apply to events as well, except for the "model" comment.

On the model comment, modularity definitely makes writing code easier, but it reduces locality of code. It makes control flow harder to understand (and thus code harder to read). Promises 'solve' that by being explicit about the callflow schematic.

Re:What's The Point Of Promises? by joezimjs on Friday March 29, 2013 @09:45AM (#5460659)
How would you have a "simple sequential control flow" with asynchronous operations?