我发现在引用插值时,Unicode和ASCII运算符的工作方式有时不同。
请考虑以下内容:
$ 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还有这个:
$ 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»但即使在使用Unicode运算符时也可以:
$ 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这是一个bug,还是有一个我看不见的解释?
发布于 2019-04-11 13:12:24
似乎是用来自MasterDuke17的commit 2835修复的:
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 '»'
}https://stackoverflow.com/questions/55569744
复制相似问题