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

Alex Russell alex at dojotoolkit.org
Thu Nov 5 15:08:11 PST 2009


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:
>
> http://lists.w3.org/Archives/Public/public-script-coord/2009OctDec/0093.html

Looks promising! A couple of thoughts:

   * the middle-ground approach seems interesting, although having  
them not be "real" arrays feels like we're just kicking the can down  
the road WRT the large-ish number of things that could be thought of  
as arrays but which don't act like them (NodeList, arguments, etc.).
   * any thoughts on type conversions? what does this do/return?:

      var bits = new Data("...");
      var res = bits += "?";

      will strings have a toData() protocol? Should other objects be  
able to implement such a protocol? will there be a canonical byte  
format for all strings in the language?
    * given that Data are array-like things that have the property of  
being packed (like arguments), maybe we're just missing a PackedArray  
superclass in general that could help w/ the efficiency concerns  
(irrespective of mutability).
    * what do you think about a toArray() method?
    * do you envision any provision for multi-dimensional Data  
objects? E.g., <canvas> data.

Regards


More information about the es-discuss mailing list