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?
Unicode is the universal character encoding used to process, store and facilitate the interchange of text data in any language while ASCII is used for the representation of text such as symbols, letters, digits, etc. in computers.
What is the difference between ASCII and Unicode? Unicode is a 16-bit character set which describes all of the keyboard characters. Why do we need to use Unicode for modern computers? Because you need all of the characters plus foreign ones too which is quite a lot of characters.
Unicode uses between 8 and 32 bits per character, so it can represent characters from languages from all around the world. It is commonly used across the internet. As it is larger than ASCII, it might take up more storage space when saving documents.
They are one and the same - you can drop the u up front. Just write strings. So instantly you should see that the literal u'4f60' is just like writing actual '4f60' . A bytes literal - aka b'some literal' - is a series of bytes.
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 '»'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With