Open p6rt opened 8 years ago
For a while we can create Pairs from named captures of match variables:
m: my %hash = key => 42; say (:$\
Sadly, this does not even parse:
m: my %hash = key => 42; say (:$/\
Nor does this create a Pair:
m: my %hash = key => 42; say (:%hash\
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 $/\
Is the first example meant to be like:
'"foo" ~~ /$\
??
On Tue, Jan 5, 2016 at 6:42 PM Tobias Leich \perl6\-bugs\-followup@​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-archive.perl.org/perl6/Ticket/Display.html?id=127165 >
For a while we can create Pairs from named captures of match variables: m: my %hash = key => 42; say (:$\
) rakudo-moar ac4f9f: OUTPUT«key => Nil» Sadly, this does not even parse: m: my %hash = key => 42; say (:$/\
) rakudo-moar ac4f9f: OUTPUT«===SORRY!=== Error while compiling /tmp/3GMq24eXRjBogus statementat /tmp/3GMq24eXRj:1------> my %hash = key => 42; say (:$⏏/\ ) expecting any of: colon pair» Nor does this create a Pair: m: my %hash = key => 42; say (:%hash\
) 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 $/\
or $\ . This would allow %hash\ , but then again $\ and $/\<key foo> need to parsefail.
The RT System itself - Status changed from 'new' to 'open'
Yes, that's how you get a Match variable.
I was confused because of the preceding hash assignment :)
I also find myself not wanting to do { long-attribute-name => $obj.long-attribute-name }. Maybe $obj.=>long-attribute-name could DWIM and :$obj.my-val becomes ('obj' => 'my-val result').
I'll be quiet now.
On Tue, Jan 5, 2016 at 7:01 PM Tobias Leich \email@​froggs\.de wrote:
Yes, that's how you get a Match variable.
Migrated from rt.perl.org#127165 (status was 'open')
Searchable as RT127165$