-
Notifications
You must be signed in to change notification settings - Fork 587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Switching to another Regex library #215
Comments
+1 |
This sounds good, but we'd need to make sure there were no performance regressions. Basically the same problem as #205 right now. I'd happily merge a patch if it made otto better support JS's RegExp object without serious performance degradation. |
what about a build tag to allow to choose regexp compatibility over performance ? |
Would consider that, if someone wants to put in a PR 👍 |
Would love some feedback on this PR which implements pluggable RegExp. |
Otto currently uses the builtin
regexp
package for regular expressions, which lacks support for backreferences. The reasoning behind this is rather well explained (the godoc page for theregexp
module links to this elaborate blog post) - in short, implementing lookbacks is impossible while still guaranteeingO(n)
execution time.Unfortunately, as long as Otto uses it, it cannot conform to the ECMA 5 specification, and a large amount of existing JS code out there will simply fail to compile on Otto - notably, both BabelJS and Traceur, the two major ways available to provide ES6 features to ES5-compatible environments, are currently incompatible with Otto.
I propose the move to a different regular expression library - this one, for example, looks rather promising, and doesn't add a cgo dependency.
The text was updated successfully, but these errors were encountered: