Skip to content

Commit 9a8d113

Browse files
committed
Split example and fix thinko
1 parent ed8aed5 commit 9a8d113

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

doc/Language/syntax.pod6

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,8 +730,9 @@ items:
730730
say [@a, 3, 4].perl; # OUTPUT: «[[1, 2], 3, 4]␤»
731731
say [|@a, 3, 4].perl; # OUTPUT: «[1, 2, 3, 4]␤»
732732
733-
L<List|/type/List> type can be explicitly created from an array literal declaration without a coercion
734-
coercion from Array, using B<is> L<trait|/language/traits> on declaration.
733+
L<List|/type/List> type can be explicitly created from an array
734+
literal declaration without a coercion from Array, using B<is>
735+
L<trait|/language/traits> on declaration.
735736
736737
my @a is List = 1, 2; # a List, not an Array
737738
# wrong: creates an Array of Lists
@@ -792,8 +793,16 @@ a coercion, using B<is> L<trait|/language/traits> on declaration:
792793
my %mix is Mix; # Mix
793794
my mix-hash is MixHash; # MixHash
794795
795-
# This is wrong: creates a Hash of Mixes, not Mix
796+
797+
Note that using a usual type declaration with a hash sigil creates a
798+
typed Hash, not a particular type:
799+
800+
# This is wrong: creates a Hash of Mixes, not Mix:
796801
my Mix %mix;
802+
# Works with $ sigil:
803+
my Mix $mix;
804+
# Can be typed:
805+
my Mix[Int] $mix-of-ints;
797806
798807
=head3 Regex literals
799808

0 commit comments

Comments
 (0)