Binary data (ByteArray/ByteVector) proposal on public-script-coord

Charles Jolley charles at
Thu Nov 5 15:21:07 PST 2009

This looks like a good approach.  I wonder if the Data/DataBuilder  
distinction could be handled better by using the Object.freeze()  
semantics.  Even if the browser does not support freezing in the  
general sense yet, you could borrow the ideas for data.

Probably the wrong API names, but here is the basic idea:

   -> returns a mutable form of the Data object

Data.prototype.freeze() or Data.freeze(aDataObject)
   -> makes the Data object frozen if it is not frozen already

   -> returns the data object but pre-frozen.  For Data object's  
already frozen can return "this"

Data.prototype.frozen - true when frozen, false otherwise.


Browser API's that return a data object can return pre-frozen data,  
allowing for all the sharing scenarios your outlined in your mail.

This is basically a copy of the mutable/immutable API of Cocoa, btw,  
just reversed.  (i.e. you get frozenCopy() instead of a mutableCopy())


On Nov 5, 2009, at 2:48 PM, Maciej Stachowiak wrote:

> I pulled together a rough proposal for representing binary data in  
> ECMAScript and posted it on public-script-coord. I think having this  
> is important for many W3C specs, but it is probably best defined in  
> ECMAScript. I'm posting a link here in case anyone is interested and  
> is not on the public-script-coord mailing list yet:
> Regards,
> Maciej
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list