Forbid implementations from extending the RegExp grammar.

Allen Wirfs-Brock allen at
Mon Jul 6 19:23:23 UTC 2015

On Jul 5, 2015, at 10:56 PM, Benjamin Gruenbaum wrote:

> So, following work on RegExp.escape [1] I found out that implementations may extend the regular expression grammar in JavaScript [2]. However, when asking esdiscuss and Stack Overflow about it [2][3] it doesn't look like any implementations currently do so (*).

Actually, almost all ES implementation extend/modify the ES RegExp pattern grammar.  Annex B.1.4 attempts to describe the interoperable RegExp extensions that are common among browsers.

> Can we please forbid implementations from extending the regular expression syntax? It seems like this could cause compatibility issues between implementations anyway. We have subclassable RegExp with hooks and symbols in place and implementations that want to provide an extended RegExp can subclass RegExp or propose an extension to the language itself.

Can't do it, won't work.   If followed, a general probation of syntactic extensions, whether for the entire language or just for RegExp patterns,would block all future language innovation.  But, it practice it would just be ignored. 

We (think) we can get away with a few very targeted and well motivated extension prohibitions such a those listed in but broad a "no new syntax" prohibition would hold and isn't desirable.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list