[Bug 17263] Keep on having send(ArrayBuffer data) interface in addition to send(ArrayBufferView data)

https://www.w3.org/Bugs/Public/show_bug.cgi?id=17263

--- Comment #3 from Glenn Maynard <glenn@zewt.org> 2012-05-31 16:24:42 UTC ---
(In reply to comment #0)
> negative reason is just for compatibility.
> But, sometimes JavaScript has an ArrayBuffer object without any
> ArrayBufferView.
> E.g., obviously JavaScript has only ArrayBuffer object which are received via
> WebSocket API.
> I think the old interface send(ArrayBuffer data) is worth to be held.

If it's genuinely needed for web compatibility, that's fine.

But if it's not, then it should be removed.  It's cheap and trivial to create
an Int8Array view around the ArrayBuffer: "xhr.send(new Int8Array(array))". 
It's not worth adding an ArrayBuffer overload to every API that accepts typed
arrays, just to avoid 15 bytes of typing (especially for something that's being
typed rather infrequently).

(In reply to comment #1)
> The problem is that then you're exposing platform endianness.

You can treat sending an ArrayBuffer as equivalent to creating an Int8Array and
sending that.  The typed array spec has major bugs around endianness, but I
don't think this would add to them.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Thursday, 31 May 2012 16:24:52 UTC