ARGUMENTS.SHOULD.BE.ARRAY bug-fix

liorean liorean at gmail.com
Sun Mar 18 14:23:50 PDT 2007


On 18/03/07, Vassily Gavrilyak <gavrilyak at gmail.com> wrote:
> The question is - will the caller side of function arguments be fixed
> the same way.
> So the following code will work
>
> function foo(){
>   alert(arguments.join());
> }
>
> foo.apply(this, [1,,2]);
> foo.call (this,  1,,2);
> this.fool(1,,2);
>
> All 3 statements means the same and looks symmetrically, but second
> and third give
> compiler errors. Is that addressed too, so we will actually have
> arguments === Array?

Isn't the first more analogous to the following?

    foo.call(this,1,undefined,2);
    this.foo(1,undefined,2);

fn.apply destructures the array, with undefined taking place of
elisions, into the arguments to send. The arguments array of the
function activation is constructed from those sent arguments, not from
the array sent to apply.

On the other hand I don't see why elisions in function calls would
really be a problem...
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list