News for hackers. Stuff that matters.
Re:Write logic, not mechanics by wonnage on Thursday April 19, 2012 @12:32PM (#3863807)
A good example of deferreds can be found in jQuery - every AJAX method returns a deferred that you can chain success, error, etc. handlers to. So it's not like this idea isn't a mainstream one.

The main problem I see is that very few libraries handle receiving promises as arguments, probably because there isn't a standard/widely-used implementation of them. So your logic ends up being backwards, e.g you'd chain Mustache.render off of a jQuery success promise, rather than just passing the success promise in.

Re:Write logic, not mechanics by gozala on Thursday April 19, 2012 @12:58PM (#3863962)
What I'm suggesting is that promises don't need any special treatment. If you have a function that you want to feed a promise just wrap it: promised(Mustache.render). That's all it takes.