6
6
7
7
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
- can surprise you, and might cost valuable time in debugging and discovery.
9
+ can surprise you and might cost valuable time in debugging and discovery.
10
10
11
11
This document aims to show common misconceptions.
12
12
@@ -49,7 +49,7 @@ The syntax C<has $.x> is short for something like
49
49
C < has $!x; method x() { $!x } > , so the actual attribute is called C < $!x > , and
50
50
a read-only accessor method is automatically generated.
51
51
52
- So the correct way to write method double is
52
+ Thus the correct way to write method C < double > is
53
53
54
54
method double {
55
55
$!x *= 2;
@@ -75,7 +75,7 @@ initializing all attributes yourself. For example
75
75
76
76
say A.new(x => 42).x; # Any
77
77
78
- ... leaves C < $!x > uninitialized, because the custom C < BUILD > doesn't initialize
78
+ leaves C < $!x > uninitialized, because the custom C < BUILD > doesn't initialize
79
79
it.
80
80
81
81
One possible remedy is to explicitly initialize the attribute in C < BUILD > :
@@ -85,7 +85,7 @@ One possible remedy is to explicitly initialize the attribute in C<BUILD>:
85
85
$!x := $x;
86
86
}
87
87
88
- ... which can be shortened to:
88
+ which can be shortened to:
89
89
90
90
submethod BUILD(:$!x) {
91
91
$!y = 18;
@@ -127,7 +127,7 @@ Ways to match whitespace:
127
127
= item C < ' ' > (a blank in quotes) to match a single blank
128
128
= item C < \t > , C < \n > for specific whitespace (tab, newline)
129
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
130
+ = item C << .ws >> , a built-in rule for whitespace that oftentimes does what you actually want it to do
131
131
= item with C < m:s/a b/ > or C < m:sigspace/a b/ > , the blank in the regexes matches arbitrary whitespace
132
132
133
133
= head1 Captures
@@ -143,7 +143,7 @@ value when that C<Capture> is later used. For example:
143
143
Here the C < Capture > contained the B < container > pointed to by C < $a > and the
144
144
B < value > of the result of the expression C < ++$a > . Since the C < Capture > must
145
145
be reified before C < &say > can use it, the C < ++$a > may happen before
146
- C < &say > looks inside the container in C < $a > , and so it may already be
146
+ C < &say > looks inside the container in C < $a > and so it may already be
147
147
incremented.
148
148
149
149
Instead, use an expression that produces a value when you want a value.
0 commit comments