async/await -> await/async: a simpler, less error-prone async syntax

Isiah Meadows isiahmeadows at gmail.com
Mon Dec 4 15:39:28 UTC 2017


Am I misunderstanding something about this proposal that it's substantially
any different from `.then` or immediately invoked async functions?

```js
// Original
await function foo() {
    const bar = async baz()
    use(bar)
}

// What I'm reading
function foo() {
    ;(async () => {
        const bar = await baz()
        use(bar)
    })()
}
function foo() {
    try {
        Promise.resolve(baz())
        .then(bar => { use(bar) })
    } catch (e) {
        Promise.reject(e)
    }
}
```

On Mon, Dec 4, 2017, 09:54 T.J. Crowder <tj.crowder at farsightsoftware.com>
wrote:

> On Mon, Dec 4, 2017 at 2:37 PM, Bob Myers <rtm at gol.com> wrote:
> >
> > It turns out that this approach has a number of problems.
> > As a result, future versions of selenium will no longer support it.
> > Test writers will be asked to write `await` where needed.
>
> Were there problems other than the complexity of maintaining the
> promise manager tool and issues with debuggability? Neither of those
> seems like it would be an issue with Steven's proposal...
>
> (I just realized for the first time, Bob, that your initials are RTM.
> I love it. You should adopt Frank as a second middle name. ;-) )
>
> -- T.J. Crowder
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171204/da8ed89e/attachment-0001.html>


More information about the es-discuss mailing list