Proposed change to typeof (was: Draft of Function.prototype.bind)

Brendan Eich brendan at mozilla.com
Wed Nov 5 00:02:32 PST 2008


On Nov 4, 2008, at 12:11 PM, David-Sarah Hopwood wrote:

> The correct fix is to make RegExp objects noncallable. This matches IE
> and Opera's behaviour and so will not "break the web".

Careful. We can reason about breaking the web if something disagrees  
with IE, but not all JS implementations agree with IE JScript (e.g.  
otherWindow.eval in IE does dynamic scope based on interleaving of  
active function objects' globals on the call stack!). No one proposes  
that all IE JScript quirks become normative standards.

 From the complaints we've heard, making typeof /hi/ == "function"  
broke compatibility badly enough that we regretted the change, and  
reverted it. But we kept regexps callable for those Mozilla-platform  
consumers who may care. Finding out what breaks will require an open  
source release cycle, at least.

I agree with Maciej that we don't know enough to say that too much  
breaks if regexps become non-callable in Firefox and Safari. We don't  
know that too little, or nothing, breaks, either. Citing Opera and IE  
doesn't help, since web JS is often user-agent forked on "isIE" tests,  
and Opera masquerades as IE (sometimes).

/be


More information about the Es-discuss mailing list