should calling RegExp constructor as function without arguments throw?

Hallvord R. M. Steen hallvord at
Wed Jan 14 05:13:13 PST 2009

Opera throws an error if you do

var foo = RegExp();

("new RegExp()" is OK though). I've noticed other engines do not throw, so
for compatibility reasons we should perhaps fix it. However, I'm inclined
to think it might simply be a mistake if a script ever does this - the
empty regexp object other engines return is after all pretty useless for
anything, no? Hence, perhaps throwing makes sense? If so please consider
standardising it. Apologies if this has already been covered, I tried  
googling but found only tangentially related stuff about "/regexp/()"  

Hallvord R. M. Steen
Core JavaScript tester, Opera Software
Opera - simply the best Internet experience

More information about the Es-discuss mailing list