Simon Cozens wrote:

> While I'm messing about with REs, is it specified how :any and hypotheticals
> interoperate?
> 
>    "ab" =~ rx:any / $match := (\w) /;
>    print $match;
> 
> Can that be undefined behaviour? Please? :)

I don't think so.

It would probably result in $0 containing an array of match objects,
one for each possible match. Each of those second tier match
objects would then have a 'match' key in its hash attribute.

Hence, to see the individual hypotheticals one might write:

        for @$0 -> $possible_match {
                print $possible_match{match}, "\n";
        }


A more intriguing possibility is that the top-level match object ($0 itself)
would *also* have a 'match' key...whose value contained a superposition of all
the possible hypotheticals. So you could also just write:

        print egs( $0{match} _ "\n" );


Bwah-ha-ha-ha-hah!!!!!!

Damian



Reply via email to