Add call and apply methods to RegExp.prototype

liorean liorean at gmail.com
Fri Dec 21 17:34:02 PST 2007


On 22/12/2007, Brendan Eich <brendan at mozilla.org> wrote:
> Summarizing my questions:
> 1. Is regexp callability worth adding in ES4?

I would say a tentative no to that. It neither adds anything new nor
significantly reduces code size. As you say, re() is only five
characters shorter than re.exec. The only real benefit from it that I
can see is that it allows generalised functions to call any
function-or-regex argument on a string, instead of having to fork the
code.

> 2. If yes to 1, do we really need .call and .apply?

I don't think it's needed, except for symmetry with real functions.




(Does this stance make me a hypocrite for being the one who filed the
RFE for this feature in Opera?)
-- 
David "liorean" Andersson



More information about the Es4-discuss mailing list