Re: [streams] Readable byte streams should support an internal queue (#353)

>>> stream@[[sourceSupportsByob]]

>> Maybe we should not allow ReadableByteStreams that don't support BYOB? It would help uncomplicate things, and would prevent the situation of giving a "false contract" where you support getByobReader() but actually it is just an inefficient shim over the normal reader.

> I guess you meant s/ReadableByteStream/building ReadableByteStream with an underlying source that doesn't support BYOB/. Maybe you're right. I'll try it out.

I remembered why I chose to have sourceSupportsByob.

I thought that it's good if we could make it able to wrap a source that doesn't understand `read(view)` with a ReadableByteStream to add BYOB reading functionality.

If we try to realize this without checking whether the source understands `read(view)` in advance:

- we issue pullInto(view) to the source
- the source, maybe, just ignores it and issues controller.enqueue()

To prepare for this, the stream needs to store the ArrayBufferViews inside itself and fill them on controller.enqueue() call. I wanted to avoid this queue which is unnecessary for sources that understand `read(view)`.

If we can require the source to understand `read(view)` and respond to it with controller.respond(), things will be simpler, but it'll be impossible to implement a source for the ReadableByteStream only with controller.enqueue().

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

Received on Wednesday, 3 June 2015 08:50:48 UTC