Unifying Binary Data and Typed Arrays

Luke Hoban lukeh at microsoft.com
Wed May 18 00:23:21 PDT 2011

At the March meeting Binary Data was promoted to a Harmony proposal, and it was agreed that it would need to be further rationalized with existing Typed Arrays in browsers, including at least being interoperable with ArrayBuffer.  With more reflection on this, I believe it is important that we embrace a single binary array model for JavaScript developers in the browser.  To do this effectively while adding the struct and reference functionality of the Binary Data proposal, it would be useful to pull the existing Typed Arrays objects into ES.next, and add on top of them the necessary functionality to support Binary Data.

We talked specifically about embracing ArrayBuffer and aligning the Binary Data Array objects with the ArrayBufferView interface.  This allows for basic interop between the existing Web APIs and Binary Data objects.  However, code is being written today using ArrayBuffer, Int32Array and related objects.  Binary data allows constructing one's own Int32Array as "new ArrayType(int32)", but this will not replace the developer desire to use Int32Array directly.  To unify the two array models, it would make sense to also embrace the specific array objects that are currently in browsers.

I've updated the Binary Data Discussion<http://wiki.ecmascript.org/doku.php?id=harmony:binary_data_discussion> page with a note on the proposed extension which would incorporate the relevant objects into the proposal, and I've augmented the Typed Arrays<http://wiki.ecmascript.org/doku.php?id=strawman:typed_arrays> page with a writeup of the relevant Typed Arrays objects in ECMAScript spec language separated from the WebIDL indirection.  As part of the rationalization of Binary Data, I'd like to suggest that we embrace a single unified binary array story that embraces both the existing Typed Arrays functionality along with the block types, structs and references from Binary Data.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110518/ce4750e0/attachment-0001.html>

More information about the es-discuss mailing list