Re: [whatwg/webidl] async iteration can produce promises, which the ES spec generally avoids (Issue #1288)

Hmm, I'm not sure if the problem actually exists. Your concern is that `value` at step 8.5.4.4 (aka `next`) is a promise. But `next` was received from `nextPromise`, which is the result of [getting the next iteration result](https://streams.spec.whatwg.org/#ref-for-dfn-get-the-next-iteration-result) for a `ReadableStream`. That algorithm returns `promise`, which is resolved with `chunk`. `chunk` could potentially be a promise, but resolving `promise` with `chunk` essentially unwraps `chunk`.

As far as I know, it's impossible to create an ES promise whose fulfilled value is another promise. Since the interface between this spec and other specs ("get the next iteration result") is, after all, a promise, the problem of doubly-wrapped promises should never happen.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1288#issuecomment-1496909501
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1288/1496909501@github.com>

Received on Wednesday, 5 April 2023 04:43:15 UTC