Binary Data - possible topic for joint session

Brendan Eich brendan at
Fri Nov 6 08:26:45 PST 2009

On Nov 6, 2009, at 1:34 AM, Maciej Stachowiak wrote:

> = Issues for the binary data API:
>    Name (potential bikeshed):
>        ByteArray
>        ByteVector
>        BinaryData
>        Data

This isn't just rank bikeshedding:

1. Data is so common a name that we can't confidently inject it into  
the global object without fear of breaking something. JSON, in spite  
of json2.js precedent, was implemented incompatibly and object- 
detected insufficiently, although this was corrected by the  
implementors (Facebook folks, much appreciated). Google codesearch  

2. Data is annoyingly close to Date.

3. Data is technically plural, and usage sometimes treats it as plural  
(ok, this is almost bikeshedding, I admit). For a String analogue this  
is awkward.

> I like "Data" and similar names. Objective-C has NSData as a  
> distinct type for chunks of binary data - it's not treated as a type  
> of array. I think this makes sense. Often the fact that a chunk of  
> binary data can be treated as an octet sequence is incidental.

It's not incidental unless you provide wider-than-byte element access  
and address byte order. Let's not, in the interest of serving API  
simplicity and common octet-sequence use-cases first and only (if we  
can hold this line).

Therefore I think a concrete name such as ByteVector or ByteArray is  
better, all else equal.

Moreover a name such as ByteVector is much easier to inject as a  
global property. No hits for the obvious function and var forms of it,  
one hit for ByteArray:


More information about the es-discuss mailing list