On Wed Oct 05 06:05:05 2011, masak wrote: > <masak> nom: my $t = q[%foo% %bar% %foo% %baz%]; my %b = foo => 1, bar > => 2, baz => 3; $t.=subst("%{.key}%", .value, :g) for %b.pairs; say $t > <p6eval> nom 4f19b7: OUTPUT«Method 'key' not found for invocant of > class 'Any' [...] > <masak> b: my $t = q[%foo% %bar% %foo% %baz%]; my %b = foo => 1, bar > => 2, baz => 3; $t.=subst("%{.key}%", .value, :g) for %b.pairs; say $t > <p6eval> b 1b7dd1: OUTPUT«1 2 1 3» > <moritz> nom: my %b = foo => 1, bar => 2, baz => 3; say "{.key}" for > %b.pairs > <p6eval> nom 4f19b7: OUTPUT«Method 'key' not found for invocant of > class 'Any' [...] > <moritz> b: my %b = foo => 1, bar => 2, baz => 3; say "{.key}" for > %b.pairs > <p6eval> b 1b7dd1: OUTPUT«foobarbaz» > <moritz> nom: say "{.key}" given a => 1 > <p6eval> nom 4f19b7: OUTPUT«Method 'key' not found for invocant of > class 'Any' [...] > <moritz> b: say "{.key}" given a => 1 > <p6eval> b 1b7dd1: OUTPUT«a» > <moritz> nom: $_ = a => 1; say "{.key}" > <p6eval> nom 4f19b7: OUTPUT«a» > <masak> odd, no? > <moritz> yes, seems like topicalization by 'given' and 'for' does > something differently > <moritz> ... different than $_ assignment, that is > * masak submits rakudobug
These all now work like b did. Closable with tests. ./perl6 > my $t = q[%foo% %bar% %foo% %baz%]; my %b = foo => 1, bar => 2, baz => 3; > $t.=subst("% {.key}%", .value, :g) for %b.pairs; say $t 1 2 1 3 > my %b = foo => 1, bar => 2, baz => 3; say "{.key}" for %b.pairs foo bar baz > say "{.key}" given a => 1 a > $_ = a => 1; say "{.key}" a -- Will "Coke" Coleda