Reputation: 1487
I found out that Unicode and ASCII operators sometimes work differently when quote-interpolated.
Consider this:
$ perl6 -e'my $a = BagHash.new: <a a a a b b b c c c c c d>;for $a.keys -> $k { say "$k => $a<<$k>>" }'
d => 1
b => 3
c => 5
a => 4
and this:
$ perl6 -e'my $a = BagHash.new: <a a a a b b b c c c c c d>;for $a.keys -> $k { say "$k => $a«$k»" }'
c => c(5) a(4) b(3) d«c»
a => c(5) a(4) b(3) d«a»
b => c(5) a(4) b(3) d«b»
d => c(5) a(4) b(3) d«d»
But this works even when using an Unicode operator:
$ perl6 -e'my $a = BagHash.new: <a a a a b b b c c c c c d>;for $a.keys -> $k { say "$k => {$a«$k»}" }'
d => 1
b => 3
a => 4
c => 5
Is this a bug, or there's an explanation I can't see?
Upvotes: 10
Views: 230
Reputation: 2288
Seems to be fixed with commit 2835 from MasterDuke17:
sub bracket_ending($matches) {
my $check := $matches[+$matches - 1];
my str $str := $check.Str;
my $last := nqp::substr($str, nqp::chars($check) - 1, 1);
- $last eq ')' || $last eq '}' || $last eq ']' || $last eq '>'
+ $last eq ')' || $last eq '}' || $last eq ']' || $last eq '>' || $last eq '»'
}
Upvotes: 5