implicit await in yield and return · Issue #114 · tc39/proposal-async-iteration (original) (raw)

This repository was archived by the owner on Jan 26, 2022. It is now read-only.

This repository was archived by the owner on Jan 26, 2022. It is now read-only.

@awto

Description

@awto

Looking at the specification for arguments of yield and return implementation needs to add another await.

Regenerator does this, babel doesn't do this and returns promise if it is indeed promise passed to yield/return, but it doesn't sound right according to the spec.

What are the reasons behind this in the spec? It looks like an obstacle for me. What if I want to return a set of Promises to run it after in, say, Promise.all?

Also may be confusing, as everywhere the async position in expressions marked explicitly and only in these two places it is implicit.