Re: [whatwg/streams] Cancelling and exception handling async iteration of ReadableStreams (Issue #1255)

> I suppose we can't depart from those semantics.

I mean, we definitely _can_. The async iterator protocol is very bare-bones, with lots of details left up to the specific iterator. The async generator case is one specific instantiation of that protocol, and perhaps is the one that has behavior people expect / the language designers intended? So I think it's a good starting place, and we should be hesitant to depart from it. But, we could depart, if we think there's a good reason and it wouldn't surprise people too much...

Regarding `AbortSignal` integration: well, first, to @hamishwillee's point, I think the best case is if your stream-creator takes an `AbortSignal`, and uses that appropriately throughout the chain. `fetch()` does that. So, I think the questions are:

- Do we want to make that easier, e.g. by adding an AbortSignal to the `ReadableStream` constructor? (I think this might be reasonable. But, how is it related to what we've done for `WritableStreamController`'s `signal` property? Should all controllers have a signal property, and all constructors accept a signal? Not sure...)

- If stream creators don't do that, should we provide affordances to let stream consumers abort earlier anyway? I'm quite unsure here.

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

Message ID: <whatwg/streams/issues/1255/1432589609@github.com>

Received on Thursday, 16 February 2023 06:25:53 UTC