Re: [streams] Consider moving stuff into ReadableStreamController (#364)

I started working on this in the [refactor innards branch](https://github.com/whatwg/streams/tree/refactor-innards). However, I got stuck, as there were a few state variables that I wasn't sure where they should go (reader, controller, or stream):

- disturbed is a property of the stream but is modified by stream.cancel(), reader.cancel(), and reader.read()
- state is used for some checks inside the stream, and it seems good to enforce those checks no matter what the controller implementation is. But it is mostly modified and consulted by the controller, sometimes by the reader too.
- storedError is similar to state.

In the end these are not insurmountable problems. We would just need to define some kind of contract for all of the shared properties, e.g. "ReadableStreamController can be implemented in any way as long as it has state and storedError slots" or "ReadableStreamController can have a pointer back to its owner readable stream in order to modify its state and storedError slots." But it was not as straightforward as I'd hoped so I'm probably going to set this aside for a bit longer. 

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

Received on Wednesday, 14 October 2015 22:27:34 UTC