News for hackers. Stuff that matters.
Re:Guido van Rossum Deconstructing Twisted's Deferreds by eagsalazar2 on Monday August 19, 2013 @08:53PM (#6240941)
Looks a lot like promises. Cancellation is missing from Q.js anyway.

One thing that always surprises me though is how people rightly are disgusted by callbacks but think promises/deferreds/futures/etc are nice. They are nicer but doing a lot of async stuff stills sucks big time even using these tools. You will write way more code and it will be way tricker than an otherwise comparable synchronous app.

Obviously sometimes you have no choice but I think one should always strive to minimize the async parts of your app as much as possible.

Re:Guido van Rossum Deconstructing Twisted's Deferreds by spartango on Tuesday August 20, 2013 @12:41AM (#6241836)
Promises, Deferreds, and Futures are all names for the same general idea, that which uses a monad to stand in for the result of operation that may or may not have been completed.

There are implementations of this concept for many languages, from Java's futures to C# Tasks to Twisted Deferred to various JS Promise/Future implementations.

One thing that I find amusing in the callbacks+/-futures discussion is Google Guava's ListenableFutures (http://code.google.com/p/guava-libraries/wiki/ListenableFutu...):

The JDK ships with Futures under java.util.concurrent, and they do what you would expect. What Guava adds is the ability to use Futures in the "pure" sense (get/check result) and with callbacks or delegates. The neat thing here is that you can use whichever paradigm is appropriate for the design of different modules of your system, and safely mix and match as needed.

Guava isn't the answer to all the questions in the Futures world, but I do think it brings a neat idea to the table here.

Re:Guido van Rossum Deconstructing Twisted's Deferreds by sethammons on Monday August 19, 2013 @11:13PM (#6241480)
Or maximize the async parts of your app as much as possible if you are wanting to build a scalable, distributed system and don't want any blocking calls :)
Re:Guido van Rossum Deconstructing Twisted's Deferreds by coldtea on Monday August 19, 2013 @11:15PM (#6241485)
>One thing that always surprises me though is how people rightly are disgusted by callbacks but think promises/deferreds/futures/etc are nice. They are nicer but doing a lot of async stuff stills sucks big time even using these tools. You will write way more code and it will be way tricker than an otherwise comparable synchronous app.

Well, nicer is all that matters...