-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Inspected objects’ symbol key properties are hidden by default #9709
Comments
You can enable this behaviour like this: util.inspect.defaultOptions.showHidden = true |
That's great advice, @vkurchatkin. Thank you. Is there a reason why this is not default, please? This issue was closed without providing a reason. |
@mightyiam Fyi, the docs about this are in https://nodejs.org/api/util.html#util_util_inspect_object_options Generally |
I somewhat agree that the current behavior is a little inconsistent: you use showHidden to include non-enumerable properties but symbol properties are normally enumerable so why do you need showHidden=true to make them show up? |
Not really, you need |
Yes, but then again, no. What I mean is this:
|
@bnoordhuis well, that's how it is in the spec, right? |
Yet, this is not about the spec, enumerability or anything like that. This is about our ability and ease when debugging is how I see it. Do you use symbol keys? If so, don't you find it unreasonable that they're not showing up in the interactive mode? I do. I find it awful. I'll make a PR if it isn't too hard. |
I use symbol key properties. And I find it awful that they do not show up in inspection. I can alter `util.inspect.defaultOptions.showHidden` each time I debug. Does that sound like fun to you? Isn't fun a core principle life? The way I see it, it is not about the spec or about what is enumerable/hidden, etc. When inspecting, it is about ease of access to the information. That's how I see it. Does anyone have any other thoughts? Fixes nodejs#9709 (which should not have been closed so fast)
I use symbol key properties. And I find it awful that they do not show up in inspection. I can alter `util.inspect.defaultOptions.showHidden` each time I debug. Does that sound like fun to you? Isn't fun a core principle life? The way I see it, it is not about the spec or about what is enumerable/hidden, etc. When inspecting, it is about ease of access to the information. That's how I see it. Does anyone have any other thoughts? Fixes: nodejs#9709
I use symbol key properties. And I find it awful that they do not show up in inspection. I can alter `util.inspect.defaultOptions.showHidden` each time I debug. Does that sound like fun to you? Isn't fun a core principle life? The way I see it, it is not about the spec or about what is enumerable/hidden, etc. When inspecting, it is about ease of access to the information. That's how I see it. Does anyone have any other thoughts? Fixes: #9709 PR-URL: #9726 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
I use symbol key properties. And I find it awful that they do not show up in inspection. I can alter `util.inspect.defaultOptions.showHidden` each time I debug. Does that sound like fun to you? Isn't fun a core principle life? The way I see it, it is not about the spec or about what is enumerable/hidden, etc. When inspecting, it is about ease of access to the information. That's how I see it. Does anyone have any other thoughts? Fixes: nodejs#9709 PR-URL: nodejs#9726 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
I find it useful to be able to inspect the contents of an object by by looking at it in an interactive session. I'll call this the "debug representation". What is the correct term, please?
Now that we have symbols I'm experimenting with using them as object keys. I think it should reduce chance of accidental name collisions/overwrites, if done properly.
Thing is—while inspection of objects with "normal" keys is easy:
Inspection of objects with symbol keys is hard:
While, obviously:
😢
I expect this:
It makes sense, doesn't it?
We already have this, so it makes sense to expect what I'm expecting, does’t it?
Chrome DevTools seems to do the right thing:
The text was updated successfully, but these errors were encountered: