Callable RegExp vs. typeof (was: Re: Draft of Function.prototype.bind.)

Juriy Zaytsev kangax.dev at gmail.com
Thu Aug 13 13:28:19 PDT 2009


On Aug 13, 2009, at 1:07 PM, Brendan Eich wrote:

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

[...]

>> callable
>> regexps were a SpiderMonkey extension never adopted by any non- 
>> Mozilla
>> JavaScript implementation AFAIK, and they introduce an irregularity  
>> in
>> the language.
>
> Not so. See https://bugs.webkit.org/show_bug.cgi?id=28117 in  
> particular https://bugs.webkit.org/show_bug.cgi?id=28117#c12  
> (quoting Luke Smith's words here):
>
> "I found that /a/("abc") is implemented (inconsistently) in Firefox  
> 3.0, Firefox 3.5, Safari 3.2.1, Safari 4, Opera 9.6.3, Opera 10  
> beta2, Chrome 3 beta, and the WebKit nightlies. It is not  
> implemented in IE6, IE7, IE8, or Chrome 2."
>
> My comment at https://bugs.webkit.org/show_bug.cgi?id=28117#c21  
> opines that we may find it hard to remove callability, but it's even  
> harder to make typeof /a/ return "function".
>
> This is an issue still.

There was a discussion of this ticket on Hacker News this morning and  
we had this slight confusion on whether giving RegExp objects a  
[[Call]] property is permitted by spec <http://news.ycombinator.com/item?id=760529 
 >. I thought it was, since section 2 clearly states that  
implementation can introduce its own extensions, but then someone made  
a point about exact wording in that section and how it seems that  
implementation can only add properties that spec doesn't mention (i.e.  
additional ones) and not those that spec mentions (such as [[Call]])  
but doesn't specify them on certain objects.

Could someone please clarify this?

Thank you.

-- 
kangax
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20090813/14a520dc/attachment.html>


More information about the es-discuss mailing list