Re: [streams] Change the model for ReadableStream to have async read() (#288)

I recommend that we stop and think about what's needed for the WritableStream to add an ExclusiveStreamWriter to it. It would give us some insight about what states async reading should have for supporting many of our requirements but without dragged by reading aspect (huge complexity).

For example, "waiting" means that you cannot `read()` on ReadableStream but it doesn't disallow `write()` on WritableStream. If we add Writer to WritableStream, we cannot tell the user that they cannot call `write()` by returning state of "waiting". We should add "locked" state.

Regarding the question I placed in https://github.com/whatwg/streams/pull/288#issuecomment-75747164, I now prefer (2) for release behavior. I've been feeling that one who called getReader() should be aware of that the stream is locked and should wait until the reader is released. Allowing something like (3) (not only for this point but for any other stuff such as that .closed can be used for getting notified of transition to "close") are huge source of complexity and doesn't benefit user so much, I guess.

I'd just add `get released()` and `"locked"` state so that the code that called getReader() and passed the reader to someone else can wait until the lock is released. Radically speaking, I think even `get released()` is unnecessary and the original caller who obtained the reader should ask the user of the reader to notify of completion of its processing manually.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/288#issuecomment-76327905

Received on Friday, 27 February 2015 04:13:57 UTC