Re: [whatwg/streams] Add @@asyncIterator to ReadableStream (#980)

> Yep, agreed, we should fix that! This was my second point in [#778 (comment)](https://github.com/whatwg/streams/issues/778#issuecomment-371717821) .

All right, I'll fix it.

Any preference on the style of the `.then` handler? The only other example where `ReadableStreamDefaultReaderRead` is used in the spec is [in step 12 of `ReadableStreamTee`](https://whatpr.org/streams/980.html#readable-stream-tee), where the `{done, value}` tuple is explicitly destructured and asserted before it's used. Do we need to do the same thing here? For example:

> 1. Return the result of <a>transforming</a> ! ReadableStreamDefaultReaderRead(_reader_) with a fulfillment handler which takes the argument _result_ and performs the following steps:
>     1. Assert: Type(_result_) is Object.
>     1. Let _value_ be ? Get(_result_, `"value"`).
>     1. Let _done_ be ? Get(_result_, `"done"`).
>     1. Assert: Type(_done_) is Boolean.
>     1. If _done_ is *true*, perform ! ReadableStreamReaderGenericRelease(_reader_).
>     1. Return ! ReadableStreamCreateReadResult(_value_, _done_, *true*).

Can we just check `result.done` directly and pass it along as-is? Or could that cause issues?

> 1. Return the result of <a>transforming</a> ! ReadableStreamDefaultReaderRead(_reader_, *true*) with a fulfillment handler which takes the argument _result_ and performs the following steps:
>     1. If _result.done_ is *true*, perform ! ReadableStreamReaderGenericRelease(_reader_).
>     1. Return _result_.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/980#issuecomment-458352605

Received on Tuesday, 29 January 2019 00:04:22 UTC