[heycam/webidl] Allow async iterators to specify return algorithms (#805)

Closes #804. Notably this allows consumers to not worry about resolving their promise with the correct iterator result.

This is on top of the stage-setting commits in #802; only the last commit is worth reviewing.

One choice I made here where the right answer wasn't immediately obvious is that calling return() while a call to next() is outstanding will reject with no side effects. This mirrors what we've done in the Streams design, and seems simpler than e.g. waiting for 1+ outstanding next()s to settle. This will only occur when manually manipulating the async iterator (as opposed to using for-await-of) so it's not a very mainline scenario. /cc @ricea in case he has any thoughts.
You can view, comment on, or merge this pull request online at:

  https://github.com/heycam/webidl/pull/805

-- Commit Summary --

  * Tweak async iterator algorithms
  * Allow "get the next iteration result" to reject
  * Editorial: async iterator cleanups
  * Allow async iterators to specify return algorithms

-- File Changes --

    M index.bs (191)

-- Patch Links --

https://github.com/heycam/webidl/pull/805.patch
https://github.com/heycam/webidl/pull/805.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/805

Received on Wednesday, 25 September 2019 11:30:24 UTC