Uh oh!
There was an error while loading. Please reload this page.
util: inspect ArrayBuffers TypedArray as well - #25006
Conversation
targos
commented
Dec 13, 2018
I find this very confusing. ArrayBuffers don't have an underlying Uint8Array, it's the opposite. |
BridgeAR
commented
Dec 13, 2018
@targos yes, I described it wrong. The point is, that inspecting two different ArrayBuffer directly can result in the same output while belonging to a very different TypedArray. This makes sure it's clear to the viewer. I am also happy with a different representation but this was the best I could come up with. |
BridgeAR
commented
Dec 13, 2018
An alternative representations I thought about was:
|
Uh oh!
There was an error while loading. Please reload this page.
BridgeAR
commented
Dec 13, 2018
BridgeAR
commented
Dec 14, 2018
@nodejs/util PTAL |
Since |
BridgeAR
commented
Dec 16, 2018
@targos I am fine with using a hexadecimal representation but I am not sure how to name the "property" (description) in that case. I could keep it as About the current state: I think it's nice to see as much as possible right away but more important: it helps identifying different ArrayBuffers from each other right away. This also has impact on e.g. comparing two ArrayBuffers with |
BridgeAR
commented
Dec 18, 2018
@targos@addaleax what do you think of either of these representations (or any potential combination of some of these):
I personally think it's important to tell the user that it is represented as |
addaleax
commented
Dec 18, 2018
@BridgeAR I think 2, 3, 4, 5, 6 are misleading because they imply an associated ArrayBufferView in one way or another that does not actually exist. I think 6 and 7 are not useful, because base64 does not provide much visual information about the contents, only a way to reconstruct it. I’d prefer for visual clutter/“specialness” to be minimal, so maybe a pseudo-property like
I’m not sure I agree – we don’t do this for |
BridgeAR
commented
Dec 18, 2018
Sounds fine to me.
Coming from your suggestion, here's a new set of possibilities. I personally prefer 1 and 2 while not having a strong preference for either. I think 3 and 5 lack a description of the "value" (looking at it alone), otherwise I would also go for a pseudo property.
|
targos
commented
Dec 18, 2018
Alternatives: |
targos
commented
Dec 19, 2018
/cc @nodejs/util |
addaleax
commented
Dec 19, 2018
@BridgeAR I think my personal preferences would be 5, 3, 2, 1, but let’s see what others think :) Re: content vs contents, maybe it’s best to leave that to a native speaker? |
BridgeAR
commented
Dec 19, 2018
@addaleax the difference between @Trott@vsemozhetbyt would you two be so kind and have a look at this? :) Thinking about it: we could maybe use a team (e.g. @targos do you have a preference for the last suggestions? |
In this particular case, I think |
Uh oh!
There was an error while loading. Please reload this page.
a5100e0 to
f58d87cComparePTAL. I reworked the output as discussed. CI https://ci.nodejs.org/job/node-test-pull-request/19772/ ✔️ |
BridgeAR
commented
Dec 27, 2018
Inspecting an ArrayBuffer now also shows their binary contents.
f58d87c to
48bde7aCompareBridgeAR
commented
Dec 27, 2018
Rebased due to conflicts. PTAL, this needs a review. |
targos
commented
Jan 1, 2019
addaleax
commented
Jan 7, 2019
addaleax
commented
Jan 9, 2019
Landed in aa07dd6 |
Inspecting an ArrayBuffer now also shows their binary contents. PR-URL: #25006 Reviewed-By: Anna Henningsen <anna@addaleax.net>
addaleax
commented
Jan 9, 2019
@BridgeAR fyi, this would need a manual backport to |
Inspecting an ArrayBuffer now also shows their binary contents. PR-URL: nodejs#25006 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Inspecting an ArrayBuffer now also shows their binary contents. PR-URL: #25006 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Inspecting an ArrayBuffer now also shows their binary contents. PR-URL: #25006 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Notable Changes * compression / zlib: * Added brotli support (Anna Henningsen and Zach Vacura) nodejs#24938 * console: * Added `inspectOptions` option (Ruben Bridgewater) nodejs#24978 * crypto: * Always accept private keys as public keys (Tobias Nießen) nodejs#25217 * deps: * Upgrade npm to v6.5.0 (Jordan Harband) nodejs#25234 * fs: * Use internalBinding('fs') internally instead of process.binding('fs') (Masashi Hirano) nodejs#22478 * http(s): * Support overriding http\\s.globalAgent (Roy Sommer) nodejs#25170 * util: * Inspect ArrayBuffers contents closely (Ruben Bridgewater) nodejs#25006 * worker: * Expose workers by default and remove `--experimental-worker` flag (Anna Henningsen) nodejs#25361 PR-URL: nodejs#25537
Notable Changes * compression / zlib: * Added brotli support (Anna Henningsen and Zach Vacura) #24938 * console: * Added `inspectOptions` option (Ruben Bridgewater) #24978 * crypto: * Always accept private keys as public keys (Tobias Nießen) #25217 * deps: * Upgrade npm to v6.5.0 (Jordan Harband) #25234 * fs: * Use internalBinding('fs') internally instead of process.binding('fs') (Masashi Hirano) #22478 * http(s): * Support overriding http\\s.globalAgent (Roy Sommer) #25170 * util: * Inspect ArrayBuffers contents closely (Ruben Bridgewater) #25006 * worker: * Expose workers by default and remove `--experimental-worker` flag (Anna Henningsen) #25361 PR-URL: #25537
Inspecting an ArrayBuffer alone now also shows the Uint8Array to which the ArrayBuffer belongs to.
I visualized it as special property even though it's not a property. I have no strong opinion about that but it seemed like the best representation.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes