Forbid implementations from extending the RegExp grammar.
C. Scott Ananian
ecmascript at cscott.net
Mon Jul 6 17:29:38 UTC 2015
Benji -- but you've just specifically mentioned that implementations
are already using the flexibility provided by the spec to experiment
with and implement ES6 features. Why are you going to foreclose that
possibility for ES2016+?
The perl community has managed to compatibly extend their regex engine
to an almost absurd degree. There are plenty of ways to add features
to your regexp that don't break "standard-compliant" regexps. I think
that's the *spirit* of the existing language in the spec, and it
should be honored. I'm fine with narrowing the scope, so we know that
new flags and characters after `(?` are "reserved", for example, but I
don't see why we have to ban future change outright.
On Mon, Jul 6, 2015 at 10:13 AM, Benjamin Gruenbaum
<benjamingr at gmail.com> wrote:
> This isn't really about `RegExp.escape` as an issue. We can always extend
> `RegExp.escape` when we make additions to the RegExp grammar as a standard
> that would not be a problematic issue since we can keep both parts in sync
> relatively easily.
> On the other hand currently implementations are allowed to diverge in their
> regular expressions which means there is no guarantee that they'll behave
> the same in some cases. This is really risky for standard behavior and if an
> implementation decides to use the clause it could create a big pain point
> for developers while keeping it compliant.
> Luckily, implementors are insightful people and implementations don't do
> that because of precisely those usability implications for end developers.
> What I'm suggesting is that we forbid implementations from extending the
> regular expressions grammar beyond the language specification and outside
> the process. Basically, we take the ECMAScript regular expression object as
> specified (minus allowing extensions) as our base line :)
> On Mon, Jul 6, 2015 at 5:03 PM, C. Scott Ananian <ecmascript at cscott.net>
>> I think it would be more worthwhile of we tried to draw a compatibility
>> boundary. Taking perlre as a baseline, for example, are there additional
>> characters we should escape in `RegExp.escape` so that implementations (and
>> the language itself) could add more perlre features without breaking
>> compatibility? The `(?...)` syntax (and flags) seems to be the de facto
>> extension point, can we protect that more narrowly?
>> On Jul 6, 2015 1:56 AM, "Benjamin Gruenbaum" <benjamingr at gmail.com> wrote:
>>> So, following work on RegExp.escape  I found out that implementations
>>> asking esdiscuss and Stack Overflow about it  it doesn't look like any
>>> implementations currently do so (*).
>>> 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.
>>>  https://github.com/benjamingr/RegExp.escape
>>> (*) some did it to implement ES2015 features before ES2015.
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
More information about the es-discuss