ES6,ES7,ES8 and beyond. A Proposed Roadmap.

Andy Wingo wingo at igalia.com
Tue Apr 23 00:12:37 PDT 2013


On Tue 23 Apr 2013 01:31, "Tab Atkins Jr." <jackalmage at gmail.com> writes:

> On Mon, Apr 22, 2013 at 2:45 PM, Sam Tobin-Hochstadt <samth at ccs.neu.edu> wrote:
>> What exactly would be the semantic difference between this and just using
>> 'yield'?
>
> The semantic difference is that 'yield' pauses your execution and
> gives control to the calling code, while 'await' pauses your execution
> and gives control to the promise.  Completely different direction of
> control-passing.

It seems quite unlikely that modern JS implementations would implement
`await' as you describe it.  It's relatively easy to suspend computation
in one function frame, which is why we can have nice things like yield.
Suspending multiple function activations is done in some language
environments, but it would be difficult to retrofit into JS
implementations, which is why we can't have nice things like await.

My 2c.

Andy


More information about the es-discuss mailing list