Proposed change to typeof
david.hopwood at industrial-designers.co.uk
Wed Nov 5 13:42:06 PST 2008
Brendan Eich wrote:
> 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.
Of course not. In this case we were talking about a case in which IE
and Opera do not implement an extension, and follow the existing standard
more closely in their implementations of 'typeof'.
"Breaking the web" is obviously only one criterion among many in deciding
whether to standardize or prohibit an extension, and I did not say
anything about those other criteria in the sentence you responded to.
> 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).
Why would anyone use callable regexps in the non-IE path of an "isIE"
test, but not in the IE path? To do that they would have to:
- care enough about cross-browser compatibility to write multiple
versions of their code, and
- ignore all of the advice on the web that advocates feature testing
over browser testing, and
- know that Mozilla has a callable regexp extension, and
- know that IE does not support this extension (if they need to use
regexps in the IE path), and
- have a burning desire to use all the extensions that are available
to them in each code path, and
- not care about browsers other than Mozilla/Firefox and IE (including
Opera in the case where it is not masquerading as IE), or else
have three or more versions of the code.
More information about the Es-discuss