W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2009

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

From: Brendan Eich <brendan@mozilla.com>
Date: Fri, 6 Nov 2009 10:47:58 -0800
Cc: Maciej Stachowiak <mjs@apple.com>, public-script-coord@w3.org, es-discuss Steen <es-discuss@mozilla.org>
Message-Id: <6F0D049F-1FA6-4E42-961F-3476CF540FCD@mozilla.com>
To: P T Withington <ptw@pobox.com>
On Nov 6, 2009, at 5:43 AM, P T Withington wrote:

> On 2009-11-05, at 19:42, Maciej Stachowiak wrote:
>> My claim is that Data is not much like these things. I believe it  
>> is more like String. It happens to be a sequence (of a very  
>> specific type), but it's specialized enough to be worth treating  
>> differently. Do people often regret that String is not an Array?
> Data is like an 8-bit "null encoded" String.  Which makes me wonder  
> if you really just want to extend String to allow different encodings.

Not for the Data use-cases.

Strings are used for binary data, which is tying our hands in  
supporting UTF-16 properly. Separate issue but we should not  
complicate String further IMHO.

>  But I also regret String not being and Array.

I agree with Maciej that having mutating methods be no-ops or throwers  
strongly suggests we not mix Array and String directly. Being able to  
apply non-mutating Array methods to string (primitive, even) arguments  
is ok. Splitting a string into an Array and mutating, then joining --  
very ok. But I don't see why you want String to *be* (is-a) an Array.

> Others must have too, because at one point I'm sure there was a  
> proposal to make [] on string mean charAt?

David Flanagan beat me to it: in ES5 and most browsers.

Received on Friday, 6 November 2009 18:48:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:01 UTC