Re: [whatwg/dom] Disposable AbortController (Issue #1405)

justinfagnani left a comment (whatwg/dom#1405)

> As it says in the OP, [@rbuckton](https://github.com/rbuckton) has [argued against this](https://github.com/whatwg/html/issues/8557#issuecomment-1724193449) because he wants some way to mark an AbortController as "closed but not aborted" and remove all callbacks, and wants this to be the default disposing behavior.

Oops, sorry, I was reading too fast. Thanks for the context. I can see why "release resources, but don't abort" might be a good default dispose behavior.


> But yes, it could be done that way. That said, I expect [a lot of tooling](https://github.com/typescript-eslint/typescript-eslint/issues/8255) to (eventually) highlight when a disposable value is not used with `using`, which means it may be undesirable for APIs which aren't primarily used this way to be disposable.
> 
> Though, maybe it _should_ primarily be used with `using`? A majority of my AbortControllers (although far from all) don't live beyond their declaring scope.

I personally most often AbortControllers stored in a class instance field or pushed into some collection, but would be fine with having to tell tooling about that, or having more sophisticated heuristics that detect that. Encouraging code to automatically release controller resources seems important enough.

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

Message ID: <whatwg/dom/issues/1405/3349561112@github.com>

Received on Tuesday, 30 September 2025 01:01:35 UTC