Garrett Smith dhtmlkitchen at
Wed Sep 10 00:22:13 PDT 2008

On Tue, Sep 9, 2008 at 11:51 PM, Mark S. Miller <erights at> wrote:
> On Tue, Sep 9, 2008 at 11:29 PM, Brendan Eich <brendan at> wrote:
>> On Sep 9, 2008, at 11:09 PM, Mark S. Miller wrote:
>>> On Tue, Sep 9, 2008 at 9:51 PM, Brendan Eich <brendan at> wrote:
>>>>> I have also assumed the existence of a "static" Function.apply which
>>>>> takes the function to be applied as an explicit first argument.
>>>> This was part of ES4 and it's in JS1.7+ in Firefox.

So Function.apply is the same as Function.prototype.apply, unless you
set the javascript version to 1.7?

>>> Since the function constructor is itself a kind of function, this
>>> overloading breaks Liskov substitutability.

Hmm. Yeah that would be kind of contradictory, wouldn't it?
Function.apply cannot be two things at once. Yeah, stuff like that is
annoying. I suppose scripts could feature detect that by checking
Function.apply.length (provided the new generic Function.apply's
length is 3, not 2).

>> If so, could you suggest a fix (a new name for Function.apply is ducking the
>> issue;
> Why ducking? If this operation is needed,

The benefit is that it might be a little shorter, I guess.

> I think a different name is
> exactly the right solution.


Function.applyCall = function(callable, context, arr) {
  return, context, arr);

(arr is an object like arguments, an Array object, a new type of collection).

It would be useful to know what implements [[Call]] that can be passed
to that. For example:

if(Function.isCallable( o )) {
  Function.callCall( o, ctx, "42" );

(callCall = Function.callCall = function(callable, context) {
  return fun.apply(context, [],2));


> --
>    Cheers,
>    --MarkM

More information about the Es-discuss mailing list