Re: [streams] Support reading bytes into buffers allocated by user code on platforms where only async read is available (#253)

I think it might be time to start trying to prototype/spec/write tests for ReadableStream/ReadableStreamReader/ReadableByteStream/ReadableByteStreamReader. I will probably not be able to get very far until next week, in Tokyo. (Well, maybe on the flight I'll get a lot done!) But let's try to outline the plan.

- The class definition should be [like I outlined above](https://github.com/whatwg/streams/issues/253#issuecomment-77453487). We'll try the `{ value, done }` read since I think we're slowly realizing that avoids some of the drawbacks of EOS. (Although @yutakahirano's IsEOS predicate also is nice, hmm.)
- We should strive to maintain our existing high test coverage where possible. #288 went through every test and rewrote it to work with an EOS read() design. I'm not sure that work is portable to { value, done } + read() only existing on a reader. But we'll need to do something similar.
- I think I will try to stick with the same underlying source interface we have now for ReadableStream? However it might be better to build on top of #287's markReadable/markWaiting/markClosed/markErrored as a base primitives with more control, and provide a helper function for queue-backed underlying sources, as @tyoshino describes? I am not sure yet. Maybe sticking with the existing one is OK since ReadableStream is inherently queue-based and we are not going to abstract that away.

Maybe another approach would be to try to agree on the API (including underlying source API) for both ReadableStream and ReadableByteStream. Then I can try to do something relatively evolutionary from the current codebase and/or from #288, and @tyoshino can try to do something evolutionary from #287, and we can see which is nicer. Although that might be a lot of duplicated effort so perhaps not.

OK, so, underlying source API. For queue-backed generic ReadableStream I think the existing API is hard to beat. Is it missing anything?

For ReadableByteStreams I am less sure. But maybe it is quite simple with our simplified interface.


---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/253#issuecomment-77493236

Received on Friday, 6 March 2015 02:01:56 UTC