-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
(re)design regex API #88
Comments
There ought to be plenty of prior art here. I'm sure you know what to do from perl and ruby. |
Honestly, neither of these languages do a really clean job — there's generally lots of dynamic variables with funny names involved. That's how Perl's always done it, and Ruby inherited that bit of nastiness from Perl. Not sure we want to go that route. The "standard" way to pass the captures of a regex is to set the variables |
Oh right that's rather awful. What about python? |
You can read about Python's support here. IMO, we're already beating Python because we can have special strings that generate regex objects at compile time and have convenient escape behavior. Strange as it may seem, I think we're in uncharted territory here. There's a reason why Larry Wall set out to give the whole business a makeover in Perl 6. |
So I had some interesting thoughts about this today. Currently the RegexMatch type is declared like this:
Now that So a much better API would be something like this:
where a
This is starting to look very much like an
This is horrible and muddled syntax, but you get what I'm driving at here. Why can't we do this with just an
|
Actually, this does remind me a bit of a pattern matching case statement:
|
We could have such a pattern-matching case statement that calls a standard
If |
Is this more like a 2.0 issue? |
This can actually be done via the do-block syntax proposed in #441, which is not breaking. Thus this ceases to be a breaking feature. |
Activate the track in config.json
Integrate with CodeTracking and support line numbers when setting breakpoints
The current approach of returning a RegexMatch object that sort of pretends to be a String is a bit fishy. We probably need to spend a good bit more time figuring out how to make application of regexes nicely usable.
The text was updated successfully, but these errors were encountered: