On Wed, Nov 12, 2014 at 7:28 PM, James Long <[email protected]> wrote: > On Wed, Nov 12, 2014 at 7:24 PM, Tab Atkins Jr. <[email protected]> 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(); > })().done(); > > 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.
But even better, if we have that syntax sugar the JS engine can automatically throw from the point of the `await` that failed. Think of it exactly like `Task.spawn` or `Promise.spawn` in current promise libs. I need to run for the night. I think we've each made our points though. _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

