Skip to content

Commit

Permalink
pass compilation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
coke committed Nov 12, 2017
1 parent 7f8cf13 commit 1aa7e07
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions doc/Language/traps.pod6
Expand Up @@ -396,10 +396,10 @@ my $x = ‘hello’;
my $y = ‘foo bar’;
my %h = $x => 42, $y => 99;
say %h«$x» # ← WRONG; assumption that $x has no whitespace
say %h«$y» # ← WRONG; this time you can clearly see how wrong it is
say %h«"$y"» # ← KINDA OK; it works but there is no good reason to do that
say %h{$y} # ← RIGHT; this is what should be used
say %h«$x»; # ← WRONG; assumption that $x has no whitespace
say %h«$y»; # ← WRONG; this time you can clearly see how wrong it is
say %h«"$y"»; # ← KINDA OK; it works but there is no good reason to do that
say %h{$y}; # ← RIGHT; this is what should be used
run «touch $x»; # ← WRONG; assumption that only one file will be created
run «touch $y»; # ← WRONG; this time you can clearly see how wrong it is
Expand Down Expand Up @@ -504,9 +504,9 @@ characters. This is not just a Perl 6 trap, the same applies to other
languages.
=begin code
say ‘groß’.lc eq ‘GROSS’.lc # ← WRONG; False
say ‘groß’.uc eq ‘GROSS’.uc # ← WRONG; True, but that's just luck
say ‘groß’.fc eq ‘GROSS’.fc # ← RIGHT; True
say ‘groß’.lc eq ‘GROSS’.lc; # ← WRONG; False
say ‘groß’.uc eq ‘GROSS’.uc; # ← WRONG; True, but that's just luck
say ‘groß’.fc eq ‘GROSS’.fc; # ← RIGHT; True
=end code
If you are working with regexes, then there is no need to use C<.fc>
Expand Down Expand Up @@ -598,9 +598,9 @@ right way to do it is to use C<$(…)> or C«<{…}>» syntax.
=for code
my $x = ‘ailemac’;
say ‘I ♥ camelia’ ~~ / $($x.flip) / # OUTPUT: «「camelia」␤»
say ‘I ♥ camelia’ ~~ / $($x.flip) /; # OUTPUT: «「camelia」␤»
my $x = ‘ailemac’;
say ‘I ♥ camelia’ ~~ / <{$x.flip}> / # OUTPUT: «「camelia」␤»
say ‘I ♥ camelia’ ~~ / <{$x.flip}> /; # OUTPUT: «「camelia」␤»
However, there is a wrong way to write it, and the problem is that
it works I<sometimes>.
Expand Down

0 comments on commit 1aa7e07

Please sign in to comment.