Binary data: Structs and ArrayBuffers

Kenneth Russell kbr at
Mon Dec 3 13:50:14 PST 2012

On Mon, Dec 3, 2012 at 11:53 AM, Jussi Kalliokoski
<jussi.kalliokoski at> wrote:
> I was just reading through the binary data proposal [1] and I have a few
> comments / questions:
> First of all, how will this integrate with the Typed Arrays? Will a struct
> have an intrinsic ArrayBuffer? What about an ArrayType instance? If they do,
> how will it react to typeless properties? Are typeless properties allowed in
> the first place (IIRC there was a talk I watched where David Herman or
> someone else said that this might be)? Will you be able to extract structs
> out of an ArrayBuffer?
> What about strings? Looking through the binary data related proposals, there
> seems to be no good way of extracting strings from binary data. Should we
> have, for example StringType(DOMString encoding, uint length, boolean
> isPadded=false) for Structs? Or, should DataView have a method for
> extracting a string from it? What about storing one?

Conversions between strings and typed arrays have been specified
separately from the core typed array specification to keep the latter
spec simple. The current effort,
, looks like it has reached stability and is ready to be implemented.
I'm not sure how this work would integrate with the ES6 spec.


> Pointers. Now it's useful if a struct can contain an array of arbitrary
> size, but we don't have pointers. We can't let the struct be of arbitrary
> size either. What are the thoughts on this?
> Arrays inside structs. Are there plans for this? They're not absolutely
> necessary, but often quite handy anyway, for example:
> StructType({
>   unique: uint32[4]
> })
> Is way simpler to manage than:
> StructType({
>   unique0: uint32,
>   unique1: uint32,
>   unique2: uint32,
>   unique3: uint32
> })
> Also, what's the plan with Typed Arrays anyway? Are we going to adopt them
> as a part of JS or leave it as an extension?
> Binary stuff is hard in a language like JavaScript, but I think that
> ultimately we'll get something workable, and would love to see more
> discussion around this!
> Cheers,
> Jussi
> [1]
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list