async/await improvements

James Long longster at
Wed Nov 12 16:28:50 PST 2014

On Wed, Nov 12, 2014 at 7:24 PM, Tab Atkins Jr. <jackalmage at> wrote:
> Marking a function as "top-level" is just syntax sugar for calling
> .done() on the returned promise.  (Assuming that .done() can forward
> rejections to window.onerror.)  It might be useful, I dunno, but it
> doesn't offer anything fundamentally new.

It would be syntax sugar for:

(async function foo() {
  var x = await bar();
  var y = await baz();

Imaging writing lots of async code, where there are lots of top-level
async functions... that seems like a wild thing to impose on users.

More information about the es-discuss mailing list