Is the first example meant to be like:

'"foo" ~~ /$<key>=.+/; say (:$<key>)'

??


On Tue, Jan 5, 2016 at 6:42 PM Tobias Leich <perl6-bugs-follo...@perl.org>
wrote:

> # New Ticket Created by  Tobias Leich
> # Please include the string:  [perl #127165]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=127165 >
>
>
> For a while we can create Pairs from named captures of match variables:
> m: my %hash = key => 42; say (:$<key>)
> rakudo-moar ac4f9f: OUTPUT«key => Nil␤»
>
> Sadly, this does not even parse:
> m: my %hash = key => 42; say (:$/<key>)
> rakudo-moar ac4f9f: OUTPUT«===SORRY!=== Error while compiling
> /tmp/3GMq24eXRj␤Bogus statement␤at /tmp/3GMq24eXRj:1␤------> my %hash =
> key => 42; say (:$⏏/<key>)␤    expecting any of:␤        colon pair␤»
>
> Nor does this create a Pair:
> m: my %hash = key => 42; say (:%hash<key>)
> rakudo-moar ac4f9f: OUTPUT«(Mu)␤»
>
> So I vote for all shown statements to create a Pair of key => Nil or key
> => Any respectively.
>
> Funnily, Arrays behave differently when used with colonpair syntax:
> m: my @array = 42, 43; say (:@array[0])
> rakudo-moar ac4f9f: OUTPUT«array => [42 43]␤»
>
> Which is also wrong, IMO.
> This case should either produce 0 => 42, or array => 42.
> If we go for the latter then the shown Hashes should also be treated as
> subscripts, and produce hash => 42, if the variable is not anonymous
> like in $/<key> or $<key>.
> This would allow %hash<key foo>, but then again $<key foo> and $/<key
> foo> need to parsefail.
>
>

Reply via email to