Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add await* as alias of await.all? (Also matches yield*) #10

Closed
Jack-Works opened this issue Jul 25, 2020 · 3 comments
Closed

Add await* as alias of await.all? (Also matches yield*) #10

Jack-Works opened this issue Jul 25, 2020 · 3 comments

Comments

@Jack-Works
Copy link
Member

No description provided.

@ljharb
Copy link
Member

ljharb commented Jul 25, 2020

No, for a few reasons:

  • it doesn’t match yield* in semantics, whatsoever
  • a big part of the reason await* was removed from async/await is that it only handled “all”
  • the * conveys no meaning here, and is confusing (it’s confusing in yield* too, but that ship has sailed)

@Jack-Works
Copy link
Member Author

it doesn’t match yield* in semantics, whatsoever

yield* expr = yield all things in the expr

await * expr = await all things in the expr

I think there is symmetry.

@ExE-Boss
Copy link
Contributor

ExE-Boss commented Jul 26, 2020

Well, yield* at least has some symmetry with function*, but async function* and await.all don’t actually have any overlap, as Promise statics don’t accept async iterables: tc39/ecma262#1909.

You could define await* foo as being await AsyncIterator.prototype.toArray.call(foo[Symbol.asyncIterator]()), which would match yield* semantics, but that would probably be confusing, and you can always use the toArray iterator helper method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants