Array methods applied to strings
Mark S. Miller
erights at google.com
Mon May 11 13:26:04 PDT 2009
On Mon, May 11, 2009 at 12:29 PM, Erik Arvidsson
<erik.arvidsson at gmail.com> wrote:
> I think the right solution would be to use a non throwing [[Put]] for
> the Array methods for backwards compatibility.
On IE: .pop.call('abc') === undefined
Since IE mutating array generics don't work on strings, cross-browser
web content does not depend on these working on strings.
> NodeList and Arguments
> are the common array like structures that people use the array
> generics for and I can see other things like ImageData getting more
> common in the near term future. Special casing String will not help
> the common case.
Having mutating operations fail silently when applied to frozen arrays
is unacceptably integrity hostile. I'd rather withdraw the addition of
numeric indexing to strings than introduce a new silent failure
 To the extent that we also wish to be compatible with
browser-specific content, since most browser instances are IE, most
browser-specific content is specific to IE (simple economics). That's
why the 3 out of 4 browser rule at
> Browser implementation unification: Consider adopting
> features that are already implemented in 3 of the 4
> browser brands, or that are deployed in 3 out 4 user
> computers and reduce cross browser incompatibilities.
This clause gives us a choice. We have consistently used that choice
to pick the saner alternative. Generally that has meant the "3 of 4
browser brands" rule. On the application of mutating array generics to
strings, the saner choice may be "3 of 4 browser instances".
More information about the es-discuss