Callable RegExp vs. typeof (was: Re: Draft of Function.prototype.bind.)
brendan at mozilla.com
Thu Aug 13 15:38:58 PDT 2009
On Aug 13, 2009, at 2:07 PM, Luke Smith wrote:
> Practically, I see no value in the extension, since it is just
> shorthand for an existing API. And the fact that it has
> repercussions elsewhere in the runtime is another point against it.
You don't need to convince me! But the extension is old, it has grown
a user base, and it's now hard to remove. If it spread via Mozilla
compatibility due to the way JS is user-agent-forked in Web content,
then I'm skeptical that this extension common among non-IE browsers
can be revoked in a coordinated and timely way.
I don't agree with Mark that fixing Array.prototype.indexOf in draft
ES5 to match all the real, shipping implementations is equivalent to
revising the typeof sub-spec per David-Sarah's proposal to match
callable-RegExp reality. That latter bit of reality is mixed: some
browsers (IE versions) do not implement RegExp [[Call]]. Others do,
but those others do not all report "function" from typeof /a/.
The messiness is not just a difference in degree of de-facto standards
agreement compared to indexOf. It also shows greater complexity in the
particulars, and in the ambiguous ES3 chapter 16 language.
So until just recently (today ;-), I was content to defer David-
Sarah's fix while we (Mozilla) tried to find a way to remove
callability from our RegExp implementation. But your summary in that
webkit.org bug shed light (for me at least) on how far this bad old
extension has spread. It's not just us at Mozilla who would have to
remove callability, which seems hard enough by itself. Could all the
non-IE implementations revoke this extension?
Anyway, thanks for your comments in that webkit bug!
More information about the es-discuss