tyre icon indicating copy to clipboard operation
tyre copied to clipboard

Functorize over the regex backend

Open Drup opened this issue 9 years ago • 4 comments

This would be nice. In particular, it may allow to implement the whole thing on top of native javascript regex (which are probably faster when used in javascript).

Drup avatar Aug 12 '16 21:08 Drup

After https://github.com/Drup/tyre/pull/18, we are now in a much better position to do this, since we only use "vanilla" regular expression operators.

Drup avatar Aug 04 '18 23:08 Drup

So, I've made two early prototype to investigate this a bit:

  • https://github.com/Drup/tyre/compare/functorized Uses a functor to abstract over the backend. The issue with that version is typed regex written with one backend will be incompatible with any other backend. The upside is that the API is unchanged once the functor is applied.

  • https://github.com/Drup/tyre/compare/poly Add a type parameter to the Tyre.t type depending on the backend. This means there might be a chance to write backend-agnostic regexs, although that would require more work and I'm not sure the final result will be so nice. The downside is that we would require new functions for the compilation aspects, and the API will require some changes. It also seems a bit cumbersome.

Drup avatar Aug 05 '18 11:08 Drup

If anyone is interested and find one version or the other better, I'm open to suggestions.

Drup avatar Aug 05 '18 11:08 Drup

False alert, marks are still needed, sorry everyone. :package:

Drup avatar Aug 17 '18 14:08 Drup