ARGUMENTS.SHOULD.BE.ARRAY bug-fix

Vassily Gavrilyak gavrilyak at gmail.com
Sun Mar 18 16:20:17 PDT 2007


On 3/19/07, Brendan Eich <brendan at mozilla.org> wrote:
> The bug fix is clearly talking only about making arguments objects
> delegate to Array.prototype. It's not talking about new syntax to
> allow holes in actual parameter lists.
>
> Note also how arguments' type may not be Array, but something
> delegating to Array.prototype. We need to finalize the spec, but
> already ES1-3 makes arguments a magic type that aliases arguments[0]
> to a in function f(a){...}. That's not something Array instances can
> do, and implementations take advantage of the fact that arguments
> appears to be an Object with magic native getter and setter behavior.
> Making arguments an Array would mean mixing in the magic, somehow. So
> when I wrote that bug fix originally, I intentionally described the
> fix as making the arguments object delegate to Array.prototype.
The spec is clear, of course arguments can't be Array. They just
"feels" as Array.
>
> Holes in actual parameter lists are something I've never heard
> requested, and people already "remember" how to pass parameters in
> any C-like language. The issue is whether novices somehow might be
> confused by the ability to write [1, , 3] but not f(1, , 3). I doubt
> anyone would be much confused.
>
> /be
>
Well, I sometimes get confused. It's very rare cases, but still
happens to me. Don't remember any C-like language, but our cousin
VBScript
allows this. And those guys are sometimes confused too.
Like here. http://www.thescripts.com/forum/thread91618.html
That's 'very corner' case, but why not just fix it, if the fix will
not break anything?

Regards,
Vassily Gavrilyak



More information about the Es4-discuss mailing list