Array methods applied to strings

Mark S. Miller erights at google.com
Mon May 11 13:40:24 PDT 2009


On Mon, May 11, 2009 at 8:40 AM, Erik Arvidsson
<erik.arvidsson at gmail.com> wrote:
> 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?


Informally, the spec language has been using the [[Put]] vs
[[ThrowingPut]] as an internal spec consistency check: We *should*
only cause [[Put]] when a failure that would have been reported by
[[ThrowingPut]](..., true) can't happen. Anywhere we do decide[1] to
suppress the reporting of such a failure, we should do so by
explicitly calling [[ThrowingPut]](..., false) instead.

We should add a note to this effect where we define [[Put]].

[1] This point is independent of whether we decide to suppress
reporting this specific failure.

-- 
    Cheers,
    --MarkM


More information about the es-discuss mailing list