On Nov 12, 2007, at 3:58 PM, Brendan Eich wrote:

>> There are couple potential problems with upgrading |instanceof| to
>> match the syntax of the revised |is|:
>>
>> 1) Function expr syntax ambiguity. Consider:
>>
>> a) x is function(p: int): int // ok
>> b) x is function(p: int): int {} // syntax error
>> c) x instanceof function(p: int): int // ok?
>> d) x instanceof function(p: int): int {} // syntax error?
>
> Oh, I see -- on second thought I meant nothing like allowing (d) --

Er, I meant (c), if you remove type annotations from the function  
param and result. In ES3 today, you can write

js> ({}) instanceof function (){}
false

It's silly, of course, because the function expression is captured by  
the right operand and could not have been constructed via operator  
new to get the left operand. But it's valid ES3 syntax, so we can't  
switch instanceof's right operand to favor a function structural type.

/be


_______________________________________________
Es4-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es4-discuss

Reply via email to