Skip to content

Add disposer and async_disposer #1488

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jasnell
Copy link

@jasnell jasnell commented May 19, 2025

An intial draft at adding the disposer and async_disposer keywords to declare that an interface implements Symbol.dispose and Symbol.asyncDispose:

interface Foo {
  disposer;
  async_disposer;
}
using foo = new Foo();
await using foo = new Foo();
  • At least two implementers are interested (and none opposed):
    • Node.js
    • Cloudflare Workers
    • ...
  • Tests are written and can be reviewed and commented upon at:
  • Implementation bugs are filed:
    • Chromium: …
    • Gecko: …
    • WebKit: …
    • Deno: …
    • Node.js: …
    • webidl2.js: …
    • widlparser: …
  • MDN issue is filed: …
  • The top of this comment includes a clear commit message to use.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@jasnell
Copy link
Author

jasnell commented May 19, 2025

This is a first attempt at resolving #1459 /cc @annevk

@jasnell
Copy link
Author

jasnell commented May 19, 2025

I'll wait to cleanup the remaining build errors once it is determined whether this will likely move forward or not.

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

Successfully merging this pull request may close these issues.

1 participant