(This thread has been inactive for a while. See
http://www.mail-archive.com/perl6-language-regex@perl.org/index.html#0
0015 for it's short history.)
Long ago Tom Christiansen wrote:
>This is useful in that it would stop being number dependent.
>For example, you can't now safely say
>
> /$var (foo) \1/
>
>and guarantee for arbitrary contents of $var that your you have
>the right number backref anymore.
>
>If I recall correctly, the Python folks addressed this. One
>might check that.
Python does, indeed, have something similar. See (?P...) and
(?P=...) at http://www.python.org/doc/current/lib/re-syntax.html .
Tom's comment points out a shortcoming in the original RFC: There's
no way to make, by name, a backref to a named group. I propose to
fix that in a revised version of RFC 150. I don't have strong
feelings about what the syntax should be. Here one idea:
The substring matched by (?%some_name: ... ) can be referred to as
$%{some_name}.
That's kind of ugly, so other suggestions are welcome. (The idea was
to do something analogous to $1, $2, etc. Unfortunately ${some_name}
is already taken. Maybe $_{some_name} would also work -- though if
%_ seems too valuable to use for this limited purpose.)