Re: [whatwg/streams] ReadableStream should be an async iterable (#778)

I prefer wrapper object and auto-cancel.

Not auto-cancelling leads to simpler code when your input has a distinct header and body. You can break out of the first loop when you get to the end of the header, and then have a second loop which processes the body. This is a niche use case, and there's other ways of doing it. The rest of the time, auto-cancel is cleaner and less error-prone.

I don't think I favour auto-release. Assuming we have auto-cancel and auto-close, then there are extremely limited extra capabilities you'd gain from auto-release:

* Get a reader. Mixing iteration with using readers is not something I'd want to encourage.
* Use a reader to observe that the stream is closed, which it always will be. Pointless.
* pipeTo or pipeThrough. Basically a really obfuscated way of closing a WritableStream. Unwise.
* Use it as an async iterator that immediately ends. Pointless.

Maybe auto-release has some aesthetic benefits I haven't considered.

-- 
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/778#issuecomment-372241235

Received on Monday, 12 March 2018 09:19:16 UTC