Array methods applied to strings
Erik Arvidsson
erik.arvidsson at gmail.com
Mon May 11 08:40:55 PDT 2009
The old behavior is indeed needed for web compatibility. All Array
methods are supposed to be generic and I know js libraries use them
heavily on NodeLists and ther non Array objects.
ES5, 15.4.4.6, has no type check by itself but it is calling
[[ThrowingPut]] which will throw when called on a String. It seems
like step 5.d needs to be changed to a [[Put]] instead?
I assume we have to update all the other Array methods as well?
On Mon, May 11, 2009 at 05:16, James Graham <jgraham at opera.com> wrote:
> It seems that ES5 throws a TypeError for constructs like
>
> Array.prototype.pop.call("abc")
>
> whereas current implementations (and, I think ES3, but I didn't check that
> closely) will return "c".
>
> Is this change intentional? There seems to be a note in the compatibility
> appendix that is about a similar, but not quite identical issue (or maybe it
> is identical and I have misunderstood). Are there grounds to be confident
> that the old behavior is not needed for web compatibility?
>
> Apologies if I have overlooked something or misunderstood something.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
--
erik
More information about the es-discuss
mailing list