Re: RFC 276 (v1) Localising Paren Counts in qr()s.
[email protected] (Hugo) Fri, 29 Sep 2000 00:43:28 +0100
| Newsgroups | perl.perl6.language.regex |
|---|---|
| Message-ID | <[email protected]> |
In <[email protected]>, Perl6 RFC Librarian writes: :MJD: :Interpolated qr() items shouldn't be recompiled anyway. They should :be treated as subroutine calls. Unfortunately, this requires a :reentrant regex engine, which Perl doesn't have. But I think it's the :right way to go, and it would solve the backreference problem, as well :as many other related problems. [...] :=head1 IMPLENTATION : :The Regex engine must be made re-entrant. : :The expansion of variables in regexes must be driven by the regex compiler :(Same problem as for RFCs 112, 166 ...) None of these are necessarily true - we could change the overloading of the Regexp object instead. Currently we have: my $re = qr{pattern}; print "$re"; .. giving 'pattern' by overloading stringification. If we overload it instead to give '(??{ $re })' (or a moral equivalent) we have a nasty hack, it is true, but it could allow us to defer the much trickier proper solution. Of course it breaks every other use of the string value, and I'm not sure how big a problem that might be. Hugo