Re: [whatwg/streams] Discussion: How should streams handle Explicit Resource Management (Issue #1307)

I definitely think that's the easiest approach to take and definitely has the fewest number of potholes ;-) ... and I'm 100% fine if we go with that, I just want to make sure the options are discussed rather than just assumed :-) 

At least in theory, supporting async disposal of a readable stream *could* be the equivalent to cancel...

```js
{
  await using rs = new ReadableStream({ ... });
}
```

By example, Node.js has implemented this pattern for Node.js streams, e.g.

```js
// a node.js stream, not a ReadableStream
const r = new stream.Readable;
r[Symbol.asyncDispose]();   // cancels and destroys the stream
```

I can see some merit in the approach but I also like the simplicity of just saying, these streams aren't disposable, only the readers/writers are.

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

Message ID: <whatwg/streams/issues/1307/1966369981@github.com>

Received on Tuesday, 27 February 2024 11:46:09 UTC