3 ms·
> You can implement JavaScript from the ES spec, but NOT regexp. The grammar doesn't really make sense [2]. The Chakra team found the same thing [3]. I haven't
by magicalist 6y ago
> You can implement JavaScript from the ES spec, but NOT regexp. The grammar doesn't really make sense [2]. The Chakra team found the same thing [3].
I haven't tried to implement the RegExp section, so I can't speak to that, but this is largely why we have Test262[1].
Also that Chakra blogpost is from 10 years ago, talking about ES5. Things have improved considerably since then, though of course we have to live with historical baggage.
> With Firefox using irregexp, it further cements this unfortunate reality.
Is this a specific unfortunate reality? I don't spot any RegExp entry in the last spec Incompatibilities section[2] that seems like a bad change or even having to do with regex grammar at all.
[1] https://github.com/tc39/test262/tree/master/test/built-ins/RegExp https://github.com/tc39/test262/tree/master/test/built-ins/R...
[2] https://www.ecma-international.org/ecma-262/#sec-additions-and-changes-that-introduce-incompatibilities-with-prior-editions https://www.ecma-international.org/ecma-262/#sec-additions-a...
- ridiculous_fish 6y agoYes, thank goodness for Test262. One implements JS-compliant regexps by doing the natural thing, and then making Test262 pass. Some things have indeed improved. The 'u' flag introduced in ES6 provides a much cleaner grammar for example. However the process is still busted. Here is a concrete example. /{1}/ is permitted by the ES6 spec (including Annex B). But in practice, "web browsers" rejected it. Rather than fixing the browsers, the spec was changed in ES8 to reflect "web-reality". https://github.com/tc39/ecma262/pull/303 https://github.com/tc39/ecma262/pull/303 Browsers could have become ES6 compliant here, with zero compatibility risk. But when there is non-compliance, it is the spec that moves.
- bawolff 6y agoThat's how specs should work, when there is a feature nobody wants and nobody has implemented.