On Wed, May 11, 2005 at 06:37:53PM +0200, Juerd wrote: > Larry Wall skribis 2005-05-11 8:30 (-0700): > > It's already the case that p5-to-p6 is going to have a *wonderful* > > time translating $7 to $1[2][0]... > > Or maybe it just has to change "(" to "$1 := (", the second "(" to "$2 > := (", etc.
More likely "$1:=[", "$2:=[", etc., to avoid the nested capture contexts. Slightly trickier is going to be handling of quantified captures, since $1 has to somehow be translated into $0 for unquantified captures and $0[-1] for quantified ones. Or we have a method in the match object that can do that for us. And in some cases it might be better to just stick :perl5 on the rule and not translate it. :-) Of course, this now begs the question -- where are things stored after doing ... ? rx :perl5 / (don't) (ray) (me) (for solar) / My guess is that within the rule they're $1, $2, $3, etc. as before, but in the match object they're $/[0], $/[1], $/[2], so that we can still properly do: ($c, $d, $e, $fg) = rx :perl5 / (don't) (ray) (me) (for solar) /; Or perhaps $1, $2, $3, etc become "smart aliases" into the match object, that somehow know what they're supposed to reference based on the rule that produced it. I.e., they're $/[1], $/[2], $/[3] for perl 6 rules and $/[0], $/[1], $/[2] for :perl5 rules. Or perhaps that just leads to total madness... Pm