Draft of Function.prototype.bind.

Brendan Eich brendan at mozilla.com
Tue Nov 4 23:20:09 PST 2008

On Nov 4, 2008, at 10:43 AM, David-Sarah Hopwood wrote:

>> Can someone provide a link to this bug, or to that prior discussion  
>> of this
>> bug? Thanks.
> Sorry, I meant to post that before.
> The bug that Brendan and I were referring to was 61911:
> <https://bugzilla.mozilla.org/show_bug.cgi?id=61911>

If you caught up on the thread, you saw that I also cited this bug:


Comment 10 complains about the incompatible change from typeof /hi/ ==  
"object" to "function".

A dup of 61911 is


wherein Ish also testifies that Safari (among others) returns "object"  
as regexp instance typeof.

> Also see <http://bugs.ecmascript.org/ticket/251>, but the discussion
> there appears to be making ES4-specific assumptions. (It is also quite
> confused when referring to ES3: Opera and MSIE's behaviour is correct
> according to the spec, but that is because they don't have callable
> regexps.)

You're right, I'm not sure why I thought otherwise.

>> On FF3.0.3, a bit of testing reveals that RegExp instances are indeed
>> callable as functions, which presumably means they have an internal  
>> [[Call]]
>> property. And they are clearly native objects, not host objects.  
>> However,
>> unlike Rhino or WebKit, of FF3.0.3 at least, typeof of a RegExp  
>> does return
>> "object". I don't see any way to rationalize this as conforming to  
>> the spec.
> I agree; that's the same reasoning I was using.
> Note that in the comments of bug 61911, Brendan used the argument that
> regexp objects were proposed to be callable in ES4, but that is  
> presumably
> back up for discussion in Harmony.

It was withdrawn from ES4 before this summer and the Oslo meeting. See


the row whose first cell contains "/regexp/('test')".

> I would recommend against it: callable
> regexps were a SpiderMonkey extension never adopted by any non-Mozilla
> JavaScript implementation AFAIK,

Thread catchup needed re: Safari JavaScriptCore / KJS, but I still  
wonder why so many testified around 2005 that Safari returned "object"  
as regexp typeof.

> and they introduce an irregularity in
> the language.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20081104/0c867d90/attachment.html>

More information about the Es-discuss mailing list