Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New principle: Write [Symbol.dispose]() and [Symbol.asyncDispose]() methods when appropriate #537

Open
jyasskin opened this issue Dec 6, 2024 · 4 comments

Comments

@jyasskin
Copy link
Contributor

jyasskin commented Dec 6, 2024

The Explicit Resource Management ECMAScript feature (using statements) is at stage 3 and is starting to be implemented in browsers. They've kindly proposed changes to a set of web APIs to help them integrate. We should add a principle to this document based on those changes so that future web APIs remember to integrate well with the feature.

@annevk
Copy link
Member

annevk commented Dec 7, 2024

Will implementations ship without those proposed integrations? That seems suboptimal for web developers.

Those kind of integrations will need Web IDL changes. Is anyone working on those?

cc @syg

@syg
Copy link

syg commented Dec 7, 2024

Will implementations ship without those proposed integrations? That seems suboptimal for web developers.

Chrome is shipping soon, yes.

I haven't heard of any concerns. This would be the first if it is a concern from Apple. I don't see an issue with shipping a syntax that uses a new symbol-based protocol, and incrementally adding support for that protocol as time goes on.

I would take issue, if, in order to ship a new protocol, all existing APIs must be upgraded to support the protocol first.

(Also, read the link above. Existing APIs can be adopted to use the feature with DisposableStack even without implementing the symbol-based protocol.)

Those kind of integrations will need Web IDL changes. Is anyone working on those?

Not that I'm aware of. @rbuckton are you interested as the proposal champion?

@annevk
Copy link
Member

annevk commented Dec 8, 2024

"From Apple" seems a little broad. It just seems unfortunate to me to not offer end-to-end integration out of the gate. And also to not have proven that the integration can work well. It's also surprising that given the many use cases none of them have been worked out. Perhaps while these APIs could theoretically integrate there's not a great need for them to do so?

(There's features without implementer interest that have gone to far greater lengths.)

@syg
Copy link

syg commented Dec 8, 2024

And also to not have proven that the integration can work well.

Can you say more what kind of proof you had in mind? Calling a method on scope exit is not, like, groundbreaking stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants