RegExps that don't modify global state?

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Sep 17 08:39:11 PDT 2014


On Sep 16, 2014, at 11:22 PM, Brendan Eich wrote:

> Jussi Kalliokoski wrote:
>> Unicode flag disabling features to enable parallelism is another footnote for WTFJS.
> 
> A bit overdone, but I agree on this point.
> 
> A separate flag per regexp, and/or a way to opt-out of RegExp.$foo altogether, seem better.

Speaking strictly from a standards perspective, it seems that we are getting a bit ahead of ourselves.

The $ properties  of RegExp and the behavior of of setting them to reflect the most recent exec is not part of any edition of ECMA-262.  It seems like they should be in Annex B, but apparently nobody has ever proposed that and/or offered a specification for them.

Getting them into Annex B sounds like the first step.

Since it is Annex B that defines them, Annex B could then also define a flag to eliminate them them.  But then a program that asserted that it didn't want to use that Annex B feature would be dependent upon the presence of Annex B support. 

Annex B contains many changes to RegExp from the base standard.  Perhaps a better way to approach this is to have a standard  (not Annex B) regexp flag (perhaps 's', for "standard" or "strict") that means that this regexp should be strictly applied using only the ES standard semantics without any Annex B or other extensions.

Allen


More information about the es-discuss mailing list