Skip to content

fs, stream: add initial Symbol.dispose and Symbol.asyncDispose support - #48518

Merged
nodejs-github-bot merged 10 commits into
nodejs:mainfrom
MoLow:symbol-dispose
Jun 25, 2023
Merged

fs, stream: add initial Symbol.dispose and Symbol.asyncDispose support#48518
nodejs-github-bot merged 10 commits into
nodejs:mainfrom
MoLow:symbol-dispose

Conversation

@MoLow

@MoLow MoLow commented Jun 22, 2023

Copy link
Copy Markdown
Member

Both TypeScript and Bable already support using (explicit resource management proposal),
adding this to node will be convenient

Co-authored-by: Benjamin Gruenbaum benjamingr@gmail.com

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 22, 2023
Comment thread doc/api/fs.md Outdated
Comment thread doc/api/stream.md Outdated
Comment thread doc/api/fs.md Outdated
Comment thread lib/internal/streams/readable.js Outdated
Comment thread doc/api/stream.md Outdated
Comment thread lib/internal/process/pre_execution.js Outdated
Comment thread lib/internal/process/pre_execution.js Outdated
Comment thread lib/internal/process/pre_execution.js Outdated

@ronag ronag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some comments.

@ronag ronag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Does await using fallback to Symbol.dispose if the async version doesn't exist?

Co-authored-by: Benjamin Gruenbaum <benjamingr@gmail.com>
@MoLow

MoLow commented Jun 22, 2023

Copy link
Copy Markdown
Member Author

Q: Does await using fallback to Symbol.dispose if the async version doesn't exist?

according to this it does:
https://github.com/tc39/proposal-explicit-resource-management#await-using-declarations-with-explicit-local-bindings

@ronag ronag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement for stream.Writable as well?

Comment thread lib/internal/process/pre_execution.js Outdated
Comment thread lib/internal/per_context/primordials.js
Comment thread lib/internal/streams/readable.js Outdated
MoLow and others added 3 commits June 22, 2023 12:51
Co-authored-by: Robert Nagy <ronagy@icloud.com>
Co-authored-by: Robert Nagy <ronagy@icloud.com>
@benjamingr

Copy link
Copy Markdown
Member

@ronag

Implement for stream.Writable as well?

Yeah, and for a lot of other things (http.Server etc), the idea here was to add the symbols and one example so we can distribute the work like we did last year with iterator-helpers.

Comment thread lib/internal/streams/readable.js Outdated
Comment thread lib/internal/streams/readable.js Outdated
benjamingr and others added 2 commits June 22, 2023 13:37
Co-authored-by: Robert Nagy <ronagy@icloud.com>
Co-authored-by: Robert Nagy <ronagy@icloud.com>
@ruyadorno

Copy link
Copy Markdown
Member

This commit does not land cleanly on v18.x-staging and will need manual backport in case we want it in v18.

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. notable-change PRs with changes that should be highlighted in changelogs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.