@@ -8,7 +8,13 @@ When learning a programming language, possibly with the background of being
8
8
familiar with another programming language, there are always some things that
9
9
can surprise you, and might cost valuable time in debugging and discovery.
10
10
11
- This document aims to show common misconceptions
11
+ This document aims to show common misconceptions.
12
+
13
+ During the making of Perl6 great pains were taken to get rid of warts in the
14
+ syntax. When you whack one wart, though, sometimes another pops up. So a lot
15
+ of time was spent finding the minimum number of warts or trying to put them
16
+ where they would rarely be seen. Because of this, Perl6's warts are in different
17
+ places than you may expect them to be when coming from another language.
12
18
13
19
= head1 Objects
14
20
@@ -69,8 +75,8 @@ initializing all attributes yourself. For example
69
75
70
76
say A.new(x => 42).x; # Any
71
77
72
- leaves C < $!x > uninitialized, because the custom C < BUILD > doesn't initialize
73
- it. And the custom BUILD
78
+ ... leaves C < $!x > uninitialized, because the custom C < BUILD > doesn't initialize
79
+ it.
74
80
75
81
One possible remedy is to explicitly initialize the attribute in C < BUILD > :
76
82
@@ -79,7 +85,7 @@ One possible remedy is to explicitly initialize the attribute in C<BUILD>:
79
85
$!x := $x;
80
86
}
81
87
82
- which can be shortened to
88
+ ... which can be shortened to:
83
89
84
90
submethod BUILD(:$!x) {
85
91
$!y = 18;
@@ -121,6 +127,7 @@ Ways to match whitespace:
121
127
= item C < ' ' > (a blank in quotes) to match a single blank
122
128
= item C < \t > , C < \n > for specific whitespace (tab, newline)
123
129
= item C < \h > , C < \v > for horizontal, vertical whitespace
130
+ = item C << .ws >> , A built-in rule that oftentimes does what you actually want to do
124
131
= item with C < m:s/a b/ > or C < m:sigspace/a b/ > , the blank in the regexes matches arbitrary whitespace
125
132
126
133
= head1 Captures
0 commit comments