Garrett Smith wrote:
> On Wed, Sep 10, 2008 at 3:41 PM, David-Sarah Hopwood
> <[EMAIL PROTECTED]> wrote:
>> Mark S. Miller wrote:
>>> On Tue, Sep 9, 2008 at 9:51 PM, Brendan Eich <[EMAIL PROTECTED]> wrote:
>
>> This can be fixed by either renaming Function.apply, or conditioning
>> on whether there are two or three arguments (the former is more elegant).
>> The important point is the need for a static 3-argument version of
>> 'apply', not what it is called. I will suggest the name 'apply3' as
>> a starting point (for symmetry and convenience 'call3' should also be
>> provided).
>
> Why would "Function.apply3" need three arguments?
Because Function.prototype.apply takes two arguments, and apply3
(or staticApply, or whatever it is called) makes the 'this' argument
explicit.
> Function.prototype.apply doesn't actually need any arguments.
No, it always takes two arguments, which may be undefined. But since
an undefined argument can't be distinguished from a missing one, that
does mean it's not possible to condition on whether there are two or
three arguments. (Besides, I withdrew the suggested name 'apply3'.)
> See for yourself:-
>
> function fun(){ alert(42); }
> Function.prototype.apply.call(fun);
This is equivalent to
Function.prototype.apply.call(fun, undefined, undefined);
--
David-Sarah Hopwood
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss