Re: [w3ctag/design-reviews] How should web standards use the new JavaScript Symbol.dispose protocol? (Discussion #800)

That's great news!!

I think I'm generally aligned with many of those recommendations, although some are more obviously good than others. Eyeballing it I'd suspect 50-70% of the suggestions there seem uncontroversial and the rest might need more discussion and confirmation.

Generally it's most obvious that the dispose protocol is a good fit if the object is "short lived" in a spatial sense (e.g. a reader/writer). It's less obvious but still probably a good fit if it has a lifecycle that is often tied to some other object (e.g. an observer). The longer lived ones are the ones I'm least sure about (e.g. AudioContext, PaymentRequest, message channel stuff). Those would benefit from exploring common code patterns that use those objects, and determining whether inserting `using` makes sense for them.

Perhaps a relevant point is: in C#, it's generally seen as bad if you don't dispose of something that's IDisposable. Should we similarly envision that on the web, a linter would warn if it saw you creating one of these objects without `using`? If so then we'd need to be somewhat conservative in how we apply this.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/discussions/800#discussioncomment-4723336
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/repo-discussions/800/comments/4723336@github.com>

Received on Thursday, 19 January 2023 01:59:55 UTC