My favorites | Sign in
v8
Project Home Downloads Wiki Issues Source Code Search
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 617: RegExps are not always callable
13 people starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  lrn%chro...@gtempaccount.com
Closed:  Jun 2011
ES5


Sign in to add a comment
 
Project Member Reported by kmillikin@chromium.org, Feb 17, 2010
Regexps can be called directly and via Function.prototype.call, but not via 
Function.prototype.apply:

V8 version 2.1.1 (candidate)
> var re = /b../
> re("abcdefg")
bcd
> re.call = Function.prototype.call
function call() { [native code] }
> re.call(null, "abcdefg")
bcd
> re.apply = Function.prototype.apply
function apply() { [native code] }
> re.apply(null, ["abcdefg"]) 
(shell):1: TypeError: Function.prototype.apply was called on /b../, which 
is a function and not a function
re.apply(null, ["abcdefg"])
   ^

Sep 30, 2010
Project Member #1 kmillikin@chromium.org
 Issue 795  has been merged into this issue.
Sep 30, 2010
Project Member #2 kmillikin@chromium.org
 Issue 886  has been merged into this issue.
Sep 30, 2010
Project Member #3 kmillikin@chromium.org
Lasse, feel free to steal this if you want to work on it.
Sep 30, 2010
#4 lrn%chro...@gtempaccount.com
(No comment was entered for this change.)
Owner: LasseReichsteinHolstNielsen
Oct 1, 2010
#5 lrn%chro...@gtempaccount.com
The general problem is that (typeof /x/) is "function" (for compatibility with JSC). As such, it should be usable everywhere a callable object is. However, it's only supported in simple function calls.

Also, for compatibility with JSC, a call should work as the default exec function, not the current exec function on the RegExp object, which might have been modified, and with the regexp as receiver.
Oct 2, 2010
#6 erights
At the 9/2010 EcmaScript meeting, I just talked to Brendan Eich of Mozilla and Oliver Hunt of Apple about their intents regarding the future callability of RegExps. They both said they intend to eventually retire the callability of RegExps and should coordinate schedules. 

As recorded at https://bugzilla.mozilla.org/show_bug.cgi?id=582717#c7 I would be happy to help coordinate synchronizing this cleanup with v8 as well. Once RegExps are not callable, their typeof must be "object" and there would be no need to "fix" Function.prototype.* to work with RegExps.
Oct 3, 2010
#7 lrn%chro...@gtempaccount.com
Removing callable regexps sounds like a great move.
Is there any estimate on when such a move could be made?


Status: PendingFurtherInfo
Dec 16, 2010
Project Member #8 kmillikin@chromium.org
 Issue 991  has been merged into this issue.
Dec 16, 2010
Project Member #9 kmillikin@chromium.org
(No comment was entered for this change.)
Summary: RegExps are not always callable
Feb 9, 2011
#10 erights@google.com
At https://mail.mozilla.org/pipermail/es-discuss/2011-February/012770.html Oliver Hunt writes:

> WebKit nightlies don't allow callable RegExps anymore -- I haven't yet heard of any fallout from this change.

I just verified on Safari Version 5.0.1 (5533.17.8, r78038). They're still callable on Minefield 4.0b12pre (the FF4 nightly) but Brendan has previously indicated that he plans to change that. 

Needs ES5 label. Since this is the info we were waiting on, I think the PendingFurtherInfo tag can be removed and we can reopen this.

Also, on WebKit nightlies, FF4, and Opera, typeof /x/ === 'object'. Obviously, this should also happen when RegExps become uncallable.


Feb 9, 2011
Project Member #11 ager@chromium.org
(No comment was entered for this change.)
Labels: ES5
Feb 10, 2011
Project Member #12 kmillikin@chromium.org
(No comment was entered for this change.)
Status: Assigned
Mar 13, 2011
Project Member #13 kmillikin@chromium.org
 Issue 1247  has been merged into this issue.
Mar 18, 2011
#14 lrn%chro...@gtempaccount.com
We are ready to switch V8 to non-callable regexps, but let's first wait and see if Safari gets any feedback on their nightly builds.
Mar 30, 2011
#15 Ms2...@gmail.com
Mozilla removed support.
Apr 12, 2011
#16 pva...@inf.u-szeged.hu
The Callable RegExp support is removed from JSC as well:
http://trac.webkit.org/changeset/76180
Jun 15, 2011
#17 lrn%chro...@gtempaccount.com
Callable regexp support has been removed from V8.
Status: Fixed
Sign in to add a comment

Powered by Google Project Hosting