-
Notifications
You must be signed in to change notification settings - Fork 31k
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
ArrayBuffer.isView() and buffer.buffer property #4420
Comments
I confirmed that v5.3.0 returns false as you are experiencing. In v0.13.0-pre this code returns false. What version are you running? |
Eemmm... 5.3.0. Windows 7. |
Correction. Mac OS X El Capitan. v5.3.0 returns true. |
/cc @trevnorris |
Try this: and read this issue #1810 this pretty much explains the behaviour you are seeing. |
|
I'm failing to see any issue here. Buffers are Uint8Array's with an altered proto. Everything here is to be expected.
You're forgetting about |
Indeed. Is that API reliable? |
It's ES spec. Not one of our own, and a read only property. Technically a getter. So should be able to rely on the returned value. |
Which spec? This one? There is no Buffer section. |
http://www.ecma-international.org/ecma-262/6.0/#sec-%typedarray%-typedarray item number 14. You're getting the objects confused. |
Yes, I see what there is now, and that is nice. But considering the history of Buffer’s implementations, and the fact that there seems to be no spec on how Buffer should exactly be done, I have concerns on how much we can rely on it’s current implementation in dependent libs. Do I understand correctly that if there is no description of that in the docs, therefore it does not fall under the stability index? |
Unfortunately these changes have been forced on us by an ever changing v8 API.
Don't follow. Mind elaborating? Are you mainly saying that more implementation details (e.g. the fact that we have |
Yes, if the |
@trevnorris I'd say the question is: is instances of |
@vkurchatkin fair question. may want to take this to the @nodejs/ctc to get a decision. |
I'm going with implementation detail (at least for now), but that is very unlikely to change, I think. |
I'm not sure we got a final agreement on this in the CTC meeting but it was close to @trevnorris' apparent preference for documenting the UInt8Array methods we're inheriting. It's not just an implementation detail. |
@rvagg Reason for that proposal is because the current documentation states:
Which I read as Someone suggested it would be safest just to document them all, hence why I brought that up in the meeting. Didn't intend for it to imply it was my preference. I'd be fine documenting that |
Closing as there does not appear to be anything further to do on this. Can reopen if necessary. |
Hello!
ArrayBuffer.isView thinks of node buffers as views to ArrayBuffers. Is this correct behaviour?
Because this is a bit non-intuitive, as
ArrayBuffer.isView()
is expected to detect TypedArrays, DataViews and stuff with ArrayBuffer as a.buffer
parameter (according to MDN). Indeed,buffer.buffer instanceof ArrayBuffer
— that is awesome (finding that out while writing this), but at least that needs to be covered by docs (?).Also
buffer.buffer
, which is ArrayBuffer, has byteLength very different from the Buffer.length. That is because of shared memory for Buffers, etc, but makes that inner ArrayBuffer useless, unfortunately..isView in spec.
Thank you for reading, just close if the issue is insubstantial IYO :)
The text was updated successfully, but these errors were encountered: