Re: [streams] ReadableStream.getReader name is a bit misleading (#308)

I’m proposing that it is sufficient to have a Reader and that all places where Stream was should just be Reader. The responsibilities previously given to a Stream can be implemented by a Reader without worrying the user. Specifically, the responsibility of guaranteeing that only the system or the user can read from the stream at any given time, can be subsumed by a Reader. From the user perspective, the ability to have multiple asynchronous readers can be a feature, and the browser can choose to starve user readers if the user gives the stream back to the browser.

However, if there were a getReader() method, I would probably have called it Symbol.reader since it is (dubiously) analogous to Symbol.iterator, but only in the sense that Iterator implements Symbol.iterator as `return this`. Down that line of reasoning, read() would be analogous to iterate(), but that collides with the notion that read():Promise<Iteration<Chunk>> is analogous to next():Iteration<Value>.

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

Received on Friday, 3 April 2015 04:14:24 UTC