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

David-Sarah Hopwood david-sarah at jacaranda.org
Thu Nov 5 16:01:49 PST 2009


Charles Jolley wrote:
> 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:
> 
> Data.prototype.copy()
>   -> 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
> 
> Data.prototype.frozenCopy()
>   -> returns the data object but pre-frozen.  For Data object's already
> frozen can return "this"
> 
> Data.prototype.frozen - true when frozen, false otherwise.

I don't know why we wouldn't just use Object.freeze. It is not unreasonable
to require support for the ES5 APIs as a prerequisite for the Data type.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 292 bytes
Desc: OpenPGP digital signature
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20091106/4cb06234/attachment.bin>


More information about the es-discuss mailing list