On 12/20/18 10:32 PM, JJ Merelo wrote:
I didn't think I needed to answer a question that can be so easily obtained from the documentation: https://docs.perl6.org/type/Match, which, unsurprisingly, says: "|Match| objects are the result of a successful regex match"
That I knew. I was looking for what exactly there were so as to be able to assign them to typed variables. Seems that they are an "everything" type similar to type Mu
$ p6 'my $x="11.2."; my Str $D0; my Str $D1; $x~~m{ (<:N>+) [.] (\d+) }; $D0 ~$0; $D1 ~ $1; print "$D0 $D1\n";' WARNINGS for -e: Useless use of "~" in expression "$D1 ~ $1" in sink context (line 1) Useless use of "~" in expression "$D0 ~$0" in sink context (line 1) Use of uninitialized value of type Str in string context.
You can also just not declare D0 as a Str. " are also string contextualizers, so
That would have been too easy. The whole purpose of the one liner was to simulate assigning a match to a series of variables that I had to type as Str. Basically, I had to leave no room for the compiler to "contextualize". It had to be a string. Thank you for the help! -T