On Tue, Sep 9, 2008 at 9:51 PM, Brendan Eich <[EMAIL PROTECTED]> 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. Suppose someone defines a
logCall function:
function logCall(thisVal, meth, args) {
log('applying ' + meth + ' to ' + args + ' with ' + thisVal);
return func.apply(thisVal, args);
}
doing a logged call to the Function constructor
logCall(Function, null, ['foo', 'bar', 'foo + bar'])
will do the wrong thing for no good reason.
--
Cheers,
--MarkM
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss