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
Merge ReadableByteStream into ReadableStream #418
Conversation
Since some changes such as auto-release removal are not reflected to RBS yet, they don't looks very close yet. But except for them, they share most of code now. To make it clear which operation is exposed to controller implementations, I've put some comments. |
Note
to get initial high level review first before working on them |
Here's a quick explanation of the interfaces between controllers and the readable byte stream. Readable byte stream controller:
|
- Add comments to close and error operation on the stream - Change the argument of PullFrom operations to controller
Awesome, thanks so much for working on this. So the readers are still owned by the stream? That is probably good, and simpler than what I was originally thinking of. Let me try to write a summary to help get my head around it. I will use ReadableStream since it is simpler. ReadableStream has:
ReadableStreamController has:
The eventual path forward, then, would be:
This sounds like it will work really well. There are probably some more complexities for the controller <-> reader interaction, but what you have so far makes sense. |
…sh a pending request only when they cannot filfill it immediately
Yes. Operations on the reader is hidden to the controller.
Right.
Right.
and Ah, I just noticed that in the last post I forgot to include
It's really nice! It'll be clear which operation belongs to which object.
Yes!
Yeah. The interface adds complication but modularization would make each class easier to understand, I guess. |
Up to 7beb159, made some bug fixes, more refactoring, enabled tee |
…bleStreamReader's
…able byte stream controller This change also adds comments to the readable stream code to clarify which operations can be used directly by clients of the readable stream controller.
Made some more commits. Merged 2e7f87e, added distributed property, and reflected auto release feature removal to the readable byte stream. |
Agreed! Yeah, given byobRequest addition, it's no longer good idea. |
As discussed at #423 (comment), I've removed the synchronous repeated pulling mechanism. Pulling criteria checking code has been simplified to be the same as ReadableStream with non-byte source. Error propagation was and is still done correctly. |
- A simple test - Check that the buffer argument works - Some typo fixes are included
Hmm, ok. Having read(view) on a reader obtained by getReader() is just confusing. ReadableStream with non-byte source still has getBYOBReader() but should be less confusing. |
Sorry. The suggestion was not to add read(view) on the reader obtained by getReader(), but make the reader obtained by getBYOBReader() (or could be renamed to getByteReader() or something) provide both read() and read(view). |
Oh, I see, I didn't realize. So our two options are:
Now that you lay this out, I think option 1 is better. But! I still don't think we need to merge the two types, unless that is convenient for spec/implementation. We can just have .getReader() return a normal reader for non-BYOB streams, and a BYOB reader for BYOB streams. Or we can merge them into one type; up to you :) |
Sorry for delay! Yeah, the option 1 is the plan I imagined. Maybe to make it less confusing, we need to rename One good thing is that we won't have In terms of code cleanness, it's ok not to make the merge happen since we've already simplified it by merging the operations behind the methods enough. |
Maybe it's time to proceed to make this ready for commit. I'll create another branch not to lose the review interaction details, and add text changes to it. |
Created a new PR: #430 |
It's time to do section reorganization previously suggested/investigated by @domenic at #418 (comment). In addition to the idea by Domenic, can we separate internal operations and ones can be used directly by clients of each class? Too much? For example, |
Regarding spec writing, I'd like to get agreement on the following items. Maybe it's good time to establish consistent rules.
|
Domenic, in the example at #418 (comment) you've put all the abstract operations in the same section but giving sub sections under it. Does this mean that you think we should use one section parallel to sections explaining each class? Can we choose to put each operation to the corresponding big section explaining the class the operation operates on? |
Hmm. My first impression is that it's a bit too much, but I'm not sure. If you want to draft a quick bullet-point version of what the TOC would look like with your idea, we could discuss further.
What I meant there was that, similar to the current spec, we want a section underneath "3 ReadableStreams" for abstract operations. Call it "3.5 Readable Stream Abstract Operations". Within that there'd be subsections. If you think the abstract operations divide up cleanly enough that they could be nested under the class sections (so, e.g., "3.2.5 Abstract Operations for In general, I'm open to suggestions on proposed organization; the best way to do that is to make concrete proposals with full TOCs.
I think we should keep the abbreviations, and we should endeavor to preserve as many links as possible. Nice short and well-curated IDs makes sense to me, for a spec that is of manageable size like this one. I could imagine moving the abstract ops to a different ID style, like
I agree that it is probably a good idea to rearrange them with prefixes like you suggest.
I think it's OK for them to not correspond perfectly. Let's keep it lexicographic. |
Done
|
So, it's done. Sorry but the diff is huge... Please take a look at #430. |
(This post was initially empty, but to summarize the changes, added a check list)
merge ReadableStreamController and ReadableByteStreamControlleradopt the while-loop based pulling routine for the non-byte source versionstop delaying pull based on the return value of the last pull call[[disturbed]]
feature to the byte source version