[whatwg/streams] Synchronous (or asynchronous) state probing on WritableStream (#463)

I attempted to redesign WritableStream to follow this basic design: https://github.com/whatwg/streams/issues/319#issuecomment-133150569.

WritableStream is designed to allow the underlying sink to react to the `write()` method invocation synchronously by using `error()` function (which is now converted into `WritableStreamDefaultController.error()`). So, when a producer facing the WritableStream attemps to `write()` to it repeatedly and synchronously, it cannot know synchronously what happened to the stream (by reaction by the underlying sink) between two consequent `write()` calls. Backpressure signal is synchronously available once we introduce `desiredSize` getter to WritableStreamDefaultWriter interface. But error signal is available only via write()'s result promise, closed promise and ready promise, i.e. asynchronously.

Shall we keep state()?

For ReadableStreamDefaultController interface, this was not a problem. While an underlying source is operating on the stream using the ReadableStreamDefaultController, the consumer who's facing the ReadableStream never reacts to the operation synchronously. Any accident in e.g. size() are synchronously notified of as exception thrown for enqueue(), close(), etc. That's all which may happen to the stream synchronously.


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/463

Received on Tuesday, 31 May 2016 08:51:19 UTC