Re: Promises (Re: New Editor's Draft of MediaStream Image Capture)

On 10/09/2014 7:25 PM, Silvia Pfeiffer wrote:
> Promises is still a very new concept. I've not seen any very large 
> application written solely with promises. In fact, Java is dropping 
> promises and moving to callbacks. It's not proven that either is 
> better. I'd be happy to run with both for a while. Deprecation of any 
> old style api should go slowly over years and not suddenly. In short: 
> I'd prefer we are stuck with callback "forever" (ie. For likely the 
> next decade).

I don't think Java's java.util.concurrent.Future was really anything 
like Javascript Promises. I see Javascript promises used more like 
callbacks and most Java code I've seen used Future.get() to 
synchronize/pass data between two threads. That's quite a different 
model than what you get under Javascript.

What do you believe is different between Javascript Promises and 
callbacks? From my point of view, Promises are just a design pattern for 
structuring callbacks. I believe Promises are a good way of making 
callback handling more consistent. At last check, there was some 
inconsistency in the way we handled callbacks and decided which 
exceptions are thrown immediately versus returned by the callbacks. 
Promises would fix most of that.

Gili

Received on Thursday, 11 September 2014 02:10:24 UTC