[streams] getting and releasing reader (#297)

I read @domenic's [pull request] (https://github.com/whatwg/streams/pull/296) and would like to talk about getting / releasing reader. If you think the PR is the right place to discuss, feel free to close this issue.

### `getReader()` should succeed on closed stream

Imagine we have a Response (in Fetch API) `res`.
`res.body.getReader()` should succeed even when the response has an empty body. That means `res.body.getReader()` should succeed when the body is closed. The result is a closed reader.

### `getReader()` should succeed on errored stream

Mainly for being consistent with the closed case. We do not lose anything by allowing this. The result is an errored reader.

### Do we need auto-release?

Currently a reader is automatically released when it is closed or errored. Do we need the functionality?
It was introduced at https://github.com/whatwg/streams/pull/251#issuecomment-66701976, but given that our API is simpler than before and the current API requires a user to be sane, I would like to revisit the problem.

Concern: What happens when canceled via stream? What happens when canceled via reader?

### Do we need `.closed` in stream?

I don't think of a use case. If we drop it, [Resource management of Response.body] (https://github.com/yutakahirano/fetch-with-streams/issues/15) will be much simpler.

The usefulness may depend on whether if keep auto-release or not.

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

Received on Friday, 13 March 2015 08:14:30 UTC