Binary data: Structs and ArrayBuffers

Jussi Kalliokoski jussi.kalliokoski at gmail.com
Wed Dec 5 01:58:19 PST 2012


On Tue, Dec 4, 2012 at 3:34 AM, David Herman <dherman at mozilla.com> wrote:

> Typed Arrays will become a special case of binary data objects. In other
> words, the binary data API generalizes typed arrays completely.
>

Sounds like a plan!


> Yes, but with some exceptions. We will be extending the API to allow
> fields of type "object" (basically, pointers to JS objects) or the type
> "any" (basically, any JS value whatsoever), but those types will not be
> allowed to expose their ArrayBuffer.
>

I see, makes sense.


> Same story: if you have the type "object" or the type "any" you can't get
> at the underlying ArrayBuffer.
>

As well as this.

As Ken says, the WhatWG string encoding/decoding spec is the way to do
> that. The important thing to recognize is that a string formats are just
> that -- encoding/decoding formats -- rather than "types." There isn't and
> won't be a string type, or a UTF8 type, or anything like that in the API.
>

Sounds good!

> Arrays inside structs. Are there plans for this? They're not absolutely
> necessary, but often quite handy anyway, for example:
> >
> > StructType({
> >   unique: uint32[4]
> > })
>
> That's definitely supported.
>

Woohoo!


> > 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?
>
> Fully adopted.
>

Excellent.


> > 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!
>
> I think binary data will be very nice in ES6, and I'm excited about where
> it's headed. We've started implementation in SpiderMonkey and hopefully
> before too long people will be able to start experimenting with it in
> nightly builds of Firefox.
>

I for one am eager to get experimenting with this! I think this will be
quite useful especially for our JS codecs project.


> Thanks for your questions!
>

Thanks for your answers!

Cheers,
Jussi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121205/55a8f091/attachment.html>


More information about the es-discuss mailing list