Promises

Axel Rauschmayer axel at rauschma.de
Tue Nov 6 16:07:15 PST 2012


Why not task.js, instead?

Different issue: do we already have a solution for a missing error handler causing silent failures? task.js should cover this, too (right?)


[[[Sent from a mobile device. Please forgive brevity and typos.]]]

Dr. Axel Rauschmayer
axel at rauschma.de
Home: http://rauschma.de
Blog: http://2ality.com

On 07.11.2012, at 00:42, "Claus Reinke" <claus.reinke at talk21.com> wrote:

>> I agree that promises should be standardized in Ecma-262.
> 
> Agreed. That would also offer the possibility to support promises
> in syntax. In ES7 (latest), I would like to see something roughly like
> 
>   { ...;
>     let x <- promise;
>     ...;
>   }
> 
> (read as "let x from promise"), desugaring into
> 
>   { ...;
>     promise.then( (x) => { ...; };
>   }
> 
> Essentially, this is an even shallower continuation than generators
> (only the remaining statements in the current statement list), but it
> is already sufficient to avoid callback nesting issues in async code. It also suffices to implement generators, but for syntax. 
> By relying on nothing but a '.then' method, this isn't tied to promises
> in the narrow sense, but provides a reusable building block for other control abstractions (to begin with, abstracting away the default
> error handling in some APIs).
> 
> Claus
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 


More information about the es-discuss mailing list