Mark S. Miller erights at
Tue Sep 9 23:51:06 PDT 2008

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.
>> Since the function constructor is itself a kind of function, this
>> overloading breaks Liskov substitutability.
> LSP is not preserved by many cases in OO languages. Is it important here?

I think it's a valuable property and should not be broken without a
compelling reason.

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

Why ducking? If this operation is needed, I think a different name is
exactly the right solution. JavaScript does dispatch based on property
name, so its method dispatch does simple name-based polymorphism. E
does method dispatch by name and arity. Java by name and a too-complex
algorithm for method selection based on argument types. In these other
cases, the extra information can be modeled as mangled into the name
that's dispatched on (and it is often implemented this way as well).
Whatever kind of name gets dispatched on, a derived member should not
override the base member of the same name without honoring the base's

> Object.apply seems misplaced). Thanks,

The object constructor is also a kind of function, so that would have
the same problem.


More information about the Es-discuss mailing list