-
-
Notifications
You must be signed in to change notification settings - Fork 31.5k
Confusing inspection for sparse arrays #11570
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I agree it's confusing but I think it's correct. Due to the trailing comma,
|
Yeah, the REPL is doing its job alright. It's just the inspection is a bit counter-intuitive. Personally I'm leaning more towards Firefox's approach. It's clear and unambiguous, and I'm worried the Unicode |
@TimothyGu @bnoordhuis what about something like this?
|
I'd be okay with that. Personally I'd prefer the |
@TimothyGu IMO it's more appropriate to mark it with |
Missing elements in sparse arrays used to be serialized to empty placeholders delimited with commas by util.inspect() and in some cases the result was a syntactically correct representation of a JavaScript array with shorter length than the original one. This commit implements @TimothyGu's suggestion to change the way util.inspect() formats sparse arrays to something similar to how Firefox shows them. Fixes: nodejs#11570
Missing elements in sparse arrays used to be serialized to empty placeholders delimited with commas by util.inspect() and in some cases the result was a syntactically correct representation of a JavaScript array with shorter length than the original one. This commit implements @TimothyGu's suggestion to change the way util.inspect() formats sparse arrays to something similar to how Firefox shows them. Fixes: nodejs#11570 PR-URL: nodejs#11576 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
See: https://bugs.chromium.org/p/v8/issues/detail?id=11570 This PR disables the Proxy test in test/parallel/test-v8-serdes.js while https://chromium-review.googlesource.com/c/v8/v8/+/2739980 is being merged. Will do another PR to re-enabled the (fixed) test once the 2739980 has landed.
In the
node
REPL, sparse elements of an array are shown as "empty":However, when one copy the resulting
[ , , ]
and reenter it into the prompt, a different array is shown, thus confusing the developer:How the Chrome inspector deals with this situation is explicitly make the inspected result not compliant JS:
Firefox is more upfront:
The text was updated successfully, but these errors were encountered: