Re: [whatwg/streams] Allow other specifications to create readable byte streams (#1130)

@domenic commented on this pull request.



> -<p algorithm>To <dfn export for="ReadableStream">close</dfn> a {{ReadableStream}} |stream|, perform
-! [$ReadableStreamDefaultControllerClose$](|stream|.[=ReadableStream/[[controller]]=]).
+<p algorithm>A {{ReadableStream}} <dfn export for="ReadableStream" lt="need more data|needs
+more data">needs more data</dfn> if its [=ReadableStream/desired size to fill up to the high water
+mark=] is greater than zero.
+
+<div algorithm>
+ To <dfn export for="ReadableStream">close</dfn> a {{ReadableStream}} |stream|:
+
+ 1. If |stream|.[=ReadableStream/[[controller]]=] [=implements=] {{ReadableByteStreamController}},
+  1. Perform !
+     [$ReadableByteStreamControllerClose$](|stream|.[=ReadableStream/[[controller]]=]).
+  1. If |stream|.[=ReadableStream/[[controller]]=].[=ReadableByteStreamController/[[pendingPullIntos]]=]
+     is not [=list/is empty|empty=], perform !
+     [$ReadableByteStreamControllerRespond$](|stream|.[=ReadableStream/[[controller]]=], 0).
+     <p class="note">The caller has to make sure not to write into the

Yeah, I think this does not match my understanding of https://github.com/whatwg/streams/pull/1130#issuecomment-878611929 . Reviewing that, I think instead we want to say something like:

- The calling specification must never transfer the current BYOB request view. Note: implementations could do something equivalent to a transfer, but in that case they'd need to modify the steps in close to use RespondWithNewView instead of Respond(,0) to keep the same observable behavior as not transfering.
- The calling specification must not write into the current BYOB request view after closing the stream.

@MattiasBuelens, WDYT?

-- 
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/1130#discussion_r669973051

Received on Wednesday, 14 July 2021 21:39:59 UTC