Re: Should send() be able to take an ArrayBufferView?

On 4/11/2012 1:16 PM, Boris Zbarsky wrote:
> On 4/11/12 4:06 PM, Glenn Maynard wrote:
>> It's a bit worse than that, actually: if you want to send only part of a
>> buffer, you have to create a whole new ArrayBuffer and copy the data
>> over.  If you just pass "view.buffer", you'll send the *whole*
>> underlying buffer, not just the slice represented by the view.
>
> Oh, that's just broken.
>
> That argues for the removal of the ArrayBuffer overload, indeed, and 
> just leaving the ArrayBufferView version.

I've got no idea where TC39 is taking things. I think that's the bigger 
issue here.
Yes, I've been bitten by trying to use .subarray  instead of .slice (as 
Glenn points out).

If ArrayBufferView becomes a JS semantic, some of this is moot; and 
ArrayBuffer is still very necessary for compatibility.

All of the postMessage semantics use ArrayBuffer AFAIK.


I know you've been circling this issue for awhile, so I'll put it out 
there again: yes, using typed arrays is difficult.


-Charles

Received on Wednesday, 11 April 2012 20:41:17 UTC