[] on String [Was: Binary data (ByteArray/ByteVector) proposal on public-script-coord]

# P T Withington (16 years ago)

On 2009-11-06, at 13:47, Brendan Eich wrote:

On Nov 6, 2009, at 5:43 AM, P T Withington wrote:

[...]

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.

It must be my Lisp/Dylan upbringing bleeding through: bit.ly/4DEIjL

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.

And I thanked him privately. I thought it was, but failed to make the
conceptual leap from [] to [[GetOwnProperty]] when searching in the
spec.