News for hackers. Stuff that matters.
Re:Callbacks are imperative, promises are functional by TheZenPsycho on Saturday March 30, 2013 @09:15PM (#5467257)
What kind of object is in your list of async operations? promises. (though probably your own ad hoc, hand rolled and poorly specified version of them)
Re:Callbacks are imperative, promises are functional by T-R on Sunday March 31, 2013 @05:13AM (#5468170)
Just plain-old native functions - that's the whole point.
Re:Callbacks are imperative, promises are functional by TheZenPsycho on Sunday March 31, 2013 @06:19PM (#5470394)
when you put "plain old native functions" in an array, with the intent of executing them in sequence, with the output of i being fed into the input of i+1, congratulations, the functions are now implicitly promises.

Because, in the end, what, semantically, is the difference between:

runqueue([func1,func2,func3,func4]); and func1().then(func2).then(func3).then(func4);

No significant difference at all, really. except the promises permit you much more flexibility and options.

Re:Callbacks are imperative, promises are functional by T-R on Monday April 01, 2013 @03:51AM (#5471969)
The difference is that the first works with all of the native list functions, as well as all of those in e.g., underscore, without any extra work. The latter doesn't. Now, the latter certainly offers some other features, but my point was that, in specifically building an HTTP server, it's been my experience that those features aren't of as much use as being able to use the native list functions to, say, map a log function onto the list of functions, or reduce while halting execution under particular conditions.