Skip to content

Commit 943c380

Browse files
committed
Add a little fluff, prune stray phrase, mention <.ws>
1 parent 134f23f commit 943c380

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/Language/traps.pod

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ When learning a programming language, possibly with the background of being
88
familiar with another programming language, there are always some things that
99
can surprise you, and might cost valuable time in debugging and discovery.
1010
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.
1218
1319
=head1 Objects
1420
@@ -69,8 +75,8 @@ initializing all attributes yourself. For example
6975
7076
say A.new(x => 42).x; # Any
7177
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.
7480
7581
One possible remedy is to explicitly initialize the attribute in C<BUILD>:
7682
@@ -79,7 +85,7 @@ One possible remedy is to explicitly initialize the attribute in C<BUILD>:
7985
$!x := $x;
8086
}
8187
82-
which can be shortened to
88+
...which can be shortened to:
8389
8490
submethod BUILD(:$!x) {
8591
$!y = 18;
@@ -121,6 +127,7 @@ Ways to match whitespace:
121127
=item C<' '> (a blank in quotes) to match a single blank
122128
=item C<\t>, C<\n> for specific whitespace (tab, newline)
123129
=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
124131
=item with C<m:s/a b/> or C<m:sigspace/a b/>, the blank in the regexes matches arbitrary whitespace
125132
126133
=head1 Captures

0 commit comments

Comments
 (0)