Comment by ridiculous_fish

3 years ago

A small but illustrative example is lookbehind assertions in regular expressions. Example regexp is /(?<=foo)bar/ which matches "bar" if preceded by "foo". This is standardized in ES2018 and remains unsupported in JSC (WebKit's JS engine).

This feature is difficult to retrofit onto an existing engine, because it requires teaching every construct to track backwards. Among major engines (JSC, SpiderMonkey, v8, and Chakra at the time), only v8 has ever implemented it.

Firefox gained support by just adopting v8's regexp engine wholesale, and I speculate the difficulty of this feature in particular was a major reason. The blog post [1] explaining this decision cited this as one of four ES2018 regexp features that were yet to be implemented, but I know from experience that lookbehinds are by far the most challenging in the list.

"Diversity of regexp engines" is maybe not that important, and Mozilla's decision to adopt v8's implementation is defensible given their resources. Still I think this is an especially clear-cut example of a web standard decreasing browser diversity.

1: https://hacks.mozilla.org/2020/06/a-new-regexp-engine-in-spi...