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

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

Received on Friday, 6 November 2009 00:03:23 UTC