ARGUMENTS.SHOULD.BE.ARRAY bug-fix

Vassily Gavrilyak gavrilyak at gmail.com
Sun Mar 18 14:35:25 PDT 2007


On 3/18/07, liorean <liorean at gmail.com> wrote:
> 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
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es4-discuss
>
Yes, of course it's the same. But still two different cases to
remember and deal with.
One behavior will be more consistent and less things to think about.

Regards
Vassily Gavrilyak



More information about the Es4-discuss mailing list