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

util: include reference anchor for circular structures #27685

Closed

Conversation

BridgeAR
Copy link
Member

This adds a reference anchor to circular structures when using
util.inspect. That way it's possible to identify with what object
the circular reference corresponds too.

// cc @nodejs/util

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot nodejs-github-bot added the util Issues and PRs related to the built-in util module. label May 14, 2019
@BridgeAR BridgeAR added the semver-major PRs that contain breaking changes and should be released in the next major version. label May 14, 2019
This adds a reference anchor to circular structures when using
`util.inspect`. That way it's possible to identify with what object
the circular reference corresponds too.
@BridgeAR BridgeAR force-pushed the add-circular-reference-anchors branch from c1c7595 to 59adf42 Compare May 14, 2019 01:29
@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR requested review from addaleax and antsmartian May 14, 2019 12:09
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

I think it’s sufficient to either pick the asterisk or ref as a symbol, using both seems to make the output a bit verbose, but either way 👍

@BridgeAR
Copy link
Member Author

@addaleax I played around with it and this just seemed the most obvious and hopefully straight forward to understand. It does also look nice to just use *1 as anchor but I fear someone might miss that while looking at some output? In the end, I am fine both ways. @nodejs/util what do you think?

I also thought about using &1 as anchor. I just fear that having a separate sign for the anchor might actually confuse some people instead of clarifying that it stands for the anchor.

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 14, 2019
@BridgeAR
Copy link
Member Author

@nodejs/tsc @nodejs/releasers I currently wonder if it would make sense to postpone landing this PR shortly before the next semver-major release date instead of in the next few days. The reason for this consideration is that this PR is not possible to be backported in a semver-patch manner, even with a compatibility patch (almost all changed code lines are test changes and most other changed lines would also have to be reverted). That would reduce the number of conflicts during the regular releases and that's something we try to achieve in the release working group at the moment. We try to take new measures against conflicts (as e.g., backporting semver-major releases with compatibility patches).
To postpone this, it'll likely require the PR to be rebased and updated again to land cleanly at a specific time before the next semver-major. It's not really possible to tell if the PR author (my point is a generic one, so it's not only about me and this specific PR) has time to do that on their own and it would be bad if the postponing would therefore result in not landing the PR after all. Thus, it would require multiple persons to be willing to potentially step up and to rebase and land the PR when it's time.

I am not sure if this is something we might want to give a try or not but I thought it's worth bringing it up and it would be great to get some feedback!

@BridgeAR
Copy link
Member Author

It's might be just as much work as resolving the conflicts to land the semver-major PRs later (including a minimal new review). So it might not be worth it.

Copy link
Contributor

@antsmartian antsmartian left a comment

Choose a reason for hiding this comment

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

Nice! I like the idea.

@addaleax
Copy link
Member

@BridgeAR I think it’s fine to land this. If you want to wait, I think it’s best to switch the labels author readyblocked?

BridgeAR added a commit to BridgeAR/node that referenced this pull request May 20, 2019
This adds a reference anchor to circular structures when using
`util.inspect`. That way it's possible to identify with what object
the circular reference corresponds too.

PR-URL: nodejs#27685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@BridgeAR
Copy link
Member Author

Landed in 9f71dbc 🎉

@BridgeAR BridgeAR closed this May 20, 2019
BridgeAR added a commit to BridgeAR/node that referenced this pull request Aug 6, 2019
This adds a reference anchor to circular structures when using
`util.inspect`. That way it's possible to identify with what object
the circular reference corresponds too.

PR-URL: nodejs#27685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
BridgeAR added a commit to BridgeAR/node that referenced this pull request Aug 6, 2019
This patch makes sure no breaking changes from the referenced
semver-major PR are backported.

Refs: nodejs#27685
@BridgeAR BridgeAR mentioned this pull request Aug 6, 2019
4 tasks
BridgeAR added a commit that referenced this pull request Sep 25, 2019
This adds a reference anchor to circular structures when using
`util.inspect`. That way it's possible to identify with what object
the circular reference corresponds too.

PR-URL: #27685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
@BridgeAR BridgeAR mentioned this pull request Sep 25, 2019
@BridgeAR BridgeAR deleted the add-circular-reference-anchors branch January 20, 2020 12:04
trentm added a commit to trentm/node-bunyan that referenced this pull request Jun 27, 2020
…rcular refs

In nodejs/node#27685 (part of node v14), how
objects with circular references are stringified with `util.inspect` changed.
trentm added a commit to trentm/node-bunyan that referenced this pull request Jun 27, 2020
…rcular refs

In nodejs/node#27685 (part of node v14), how
objects with circular references are stringified with `util.inspect` changed.
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. semver-major PRs that contain breaking changes and should be released in the next major version. util Issues and PRs related to the built-in util module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants