Remix.run Logo
thayne 8 days ago

Is it? I can't think of a non-contrived case where this would actually be useful.

And in any case where it would be useful, it seems like a better way to optimize would just be to refactor the regex out into a constant.

naniwaduni 8 days ago | parent | next [-]

The context is that this is a feature cribbed straight from perl, where where it's passed down from perl 4/pre-5.6, where compiled regexen weren't first-class values. Pretty much every use of it this century is a mistake.

kayodelycaon 8 days ago | parent | prev | next [-]

Actually, I have a way this would work well. If you’re interpolating a value that comes from configuration and wouldn’t change.

Example: /admin@#{Rails.config.x.domain}/io

But you’re right that a constant would be a lot more clear. “o” is a footgun.

baobun 7 days ago | parent | prev [-]

An HTTP application server matching routes based on runtime configiuration (domains and whatnot) is not really that niche or contrived? Loads of other situations where input not changing during the thread/process lifecycle is part of a set of hot regexes large enough that explicitly compiling each is not a great experience.

I, for one, appreciate /o.