@@ -75,7 +75,7 @@ The container type can be set with C<is> in a declaration.
75
75
For information on variables without sigils, see
76
76
L < sigilless variables|#Sigilless variables > .
77
77
78
- = head2 Item and List Assignment
78
+ = head2 Item and list assignment
79
79
80
80
There are two types of variable assignment, I < item assignment > and I < list
81
81
assignment > . Both use the equal sign C < = > as operator. The syntax of the
@@ -193,7 +193,7 @@ only depends on the C<$>.
193
193
194
194
= end table
195
195
196
- = head2 The C < * > Twigil
196
+ = head2 The C < * > twigil
197
197
X < |$* >
198
198
199
199
This twigil is used for dynamic variables which are looked up through the caller's, not through the outer,
@@ -256,7 +256,7 @@ boolean context before using it for anything else:
256
256
Dynamic variables can have lexical scope when declared with C < my > or package scope when declared with C < our > . Dynamic resolution and resolution through symbol tables introduced with C < our > are two orthogonal issues.
257
257
258
258
259
- = head2 The C < ? > Twigil
259
+ = head2 The C < ? > twigil
260
260
X < |$? >
261
261
262
262
Compile-time variables may be addressed via the C < ? > twigil. They are known
@@ -270,7 +270,7 @@ example for this is:
270
270
For a list of these special variables, see
271
271
L < compile-time variables|/language/variables#Compile-time_variables > .
272
272
273
- = head2 The C < ! > Twigil
273
+ = head2 The C < ! > twigil
274
274
X < |$! >
275
275
276
276
L < Attributes|/language/objects#Attributes > are variables that exist per instance
@@ -293,7 +293,7 @@ you though. For more details on objects, classes and their attributes see
293
293
L < object orientation|/language/objects > .
294
294
295
295
296
- = head2 The C < . > Twigil
296
+ = head2 The C < . > twigil
297
297
X < |$. >
298
298
299
299
The C < . > twigil isn't really for variables at all. In fact, something along
@@ -326,13 +326,13 @@ is also possible:
326
326
For more details on objects, classes and their attributes and methods see
327
327
L < object orientation|/language/objects > .
328
328
329
- = head2 The C < ^ > Twigil
329
+ = head2 The C < ^ > twigil
330
330
X < |$^ >
331
331
332
- The C < ^ > twigil declares a formal positional parameter to blocks or
333
- subroutines. Variables of the form C < $^variable > are a type of placeholder
334
- variable. They may be used in bare blocks to declare formal parameters to
335
- that block. So the block in the code
332
+ The C < ^ > twigil declares a formal positional parameter to blocks or subroutines;
333
+ that is, variables of the form C < $^variable > are a type of placeholder variable.
334
+ They may be used in bare blocks to declare formal parameters to that block. So
335
+ the block in the code
336
336
337
337
my @powers-of-three = 1,3,9…100;
338
338
say reduce { $^b - $^a }, 0, |@powers-of-three;
@@ -362,7 +362,7 @@ Placeholder variables cannot have type constraints or a variable name with a
362
362
single upper-case letter (this is disallowed to enable catching some
363
363
Perl5-isms).
364
364
365
- = head2 The C < : > Twigil
365
+ = head2 The C < : > twigil
366
366
X < |$: >
367
367
368
368
The C < : > twigil declares a formal named parameter to a block or subroutine.
@@ -376,7 +376,7 @@ therefore not ordered using Unicode order, of course). So this:
376
376
377
377
See L < ^ > for more details about placeholder variables.
378
378
379
- = head2 The C < = > Twigil
379
+ = head2 The C < = > twigil
380
380
X < |$= >
381
381
382
382
The C < = > twigil is used to access Pod variables. Every Pod block in the
@@ -400,7 +400,7 @@ hierarchical data structure through C<$=pod>.
400
400
Note that all those C < $=someBlockName > support the C < Positional > and the
401
401
C < Associative > roles.
402
402
403
- = head2 The C < ~ > Twigil
403
+ = head2 The C < ~ > twigil
404
404
X < |$~ >
405
405
406
406
The C < ~ > twigil is for referring to sublanguages (called slangs). The
@@ -426,7 +426,7 @@ augment slang Regex { # derive from $~Regex and then modify $~Regex
426
426
}
427
427
= end code
428
428
429
- = head1 Variable Declarators and Scope
429
+ = head1 Variable declarators and scope
430
430
431
431
Most of the time it's enough to create a new variable using the C < my >
432
432
keyword:
@@ -457,7 +457,7 @@ predefined variables:
457
457
temp Restores a variable's value at the end of scope
458
458
let Restores a variable's value at the end of scope if the block exits unsuccessfully
459
459
460
- = head2 The C < my > Declarator
460
+ = head2 The C < my > declarator
461
461
462
462
Declaring a variable with C < my > gives it lexical scope. This means it only
463
463
exists within the current block. For example:
@@ -520,7 +520,7 @@ variable using L<the * twigil|#The_*_Twigil>. This twigil makes the compiler loo
520
520
C < my > is the default scope for subroutines, so C < my sub x() {} > and
521
521
C < sub x() {} > do exactly the same thing.
522
522
523
- = head2 The C < our > Declarator
523
+ = head2 The C < our > declarator
524
524
525
525
C < our > variables work just like C < my > variables, except that they also
526
526
introduce an alias into the symbol table.
@@ -573,7 +573,7 @@ To skip elements in the list use the anonymous state variable C<$>.
573
573
say [$a, %h].perl;
574
574
# OUTPUT: «["b", {:th(1)}]»
575
575
576
- = head2 The C < has > Declarator
576
+ = head2 The C < has > declarator
577
577
578
578
C < has > scopes attributes to instances of a class or role, and methods to
579
579
classes or roles. C < has > is implied for methods, so C < has method x() {} >
@@ -582,7 +582,7 @@ and C<method x() {}> do the same thing.
582
582
See L < object orientation|/language/objects > for more documentation and some
583
583
examples.
584
584
585
- = head2 The C < anon > Declarator
585
+ = head2 The C < anon > declarator
586
586
587
587
The C < anon > declarator prevents a symbol from getting installed in the lexical
588
588
scope, the method table and everywhere else.
@@ -597,7 +597,7 @@ but still aren't installed in a scope:
597
597
say %operations<square>.name; # square
598
598
say %operations<square>(8); # 64
599
599
600
- = head2 The C < state > Declarator
600
+ = head2 The C < state > declarator
601
601
602
602
C < state > declares lexically scoped variables, just like C < my > . However,
603
603
initialization happens exactly once the first time the initialization
@@ -671,7 +671,7 @@ State variables are shared between all threads. The result can be unexpected.
671
671
# many other more or less odd variations can be produced
672
672
673
673
X < |anon state variables > X < |nameless variables > X < |$ (variable) >
674
- = head3 The C < $ > Variable
674
+ = head3 The C < $ > variable
675
675
676
676
In addition to explicitly declared named state variables, C < $ > can be used
677
677
as an anonymous state variable without an explicit C < state > declaration.
@@ -719,7 +719,7 @@ subset DynInt where $ = ::('Int'); # the initializer will be called for each typ
719
719
subset DynInt where state $ = ::('Int'); # the initializer is called once, this is a proper cache
720
720
= end code
721
721
722
- = head3 The C < @ > Variable
722
+ = head3 The C < @ > variable
723
723
724
724
Similar to the C < $ > variable, there is also a L < Positional >
725
725
anonymous state variable C < @ > .
@@ -754,7 +754,7 @@ to do anything useful with it.
754
754
As with C < $ > , each mention of C < @ > in a scope introduces a new anonymous
755
755
array.
756
756
757
- = head3 The C < % > Variable
757
+ = head3 The C < % > variable
758
758
759
759
In addition, there's an L < Associative > anonymous state variable C < % > .
760
760
@@ -786,7 +786,7 @@ access is also possible (with copying to make it useful).
786
786
As with the other anonymous state variables, each mention of C < % > within a
787
787
given scope will effectively introduce a separate variable.
788
788
789
- = head2 The C < augment > Declarator
789
+ = head2 The C < augment > declarator
790
790
791
791
With C < augment > , you can add attributes and methods to existing classes and
792
792
grammars, provided you activated the C < MONKEY-TYPING > pragma first.
@@ -805,7 +805,7 @@ are better solutions.
805
805
(In this case, the better solution would be to use a
806
806
L < function|/language/functions > ).
807
807
808
- = head2 The C < temp > Prefix
808
+ = head2 The C < temp > prefix
809
809
810
810
Like C < my > , C < temp > restores the old value of a variable at the end of its
811
811
scope. However, C < temp > does not create a new variable.
@@ -841,7 +841,7 @@ scope. However, C<temp> does not create a new variable.
841
841
# </g>
842
842
# </g>»
843
843
844
- = head2 The C < let > Prefix
844
+ = head2 The C < let > prefix
845
845
846
846
Restores the previous value if the block exits unsuccessfully. A
847
847
successful exit means the block returned a defined value or a list.
@@ -864,9 +864,7 @@ stay as 84 because the block returns a defined value (C<say> returns
864
864
true). Otherwise the C < die > statement will cause the block to exit
865
865
unsuccessfully, resetting the answer to 42.
866
866
867
- = comment this is duplicated in operators.pod
868
-
869
- = head1 Type Constraints and Initialization
867
+ = head1 Type constraints and initialization
870
868
871
869
Variables have a type constraint via the L < container|/language/containers > they
872
870
are bound to, which goes between the declarator and the variable name. The
@@ -902,7 +900,7 @@ re-applied by assigning C<Nil> to it:
902
900
$product = Nil;
903
901
say $product; # OUTPUT: «1»
904
902
905
- = head2 Default Defined Variables Pragma
903
+ = head2 Default defined variables pragma
906
904
907
905
To force all variables to have a L < definitness|/language/mop#index-entry-syntax_DEFINITE-DEFINITE >
908
906
constraint, use the pragma C < use variables :D > . The pragma is lexically scoped and can be
@@ -931,7 +929,7 @@ As the name suggests, this pragma applies only to variables. To effect
931
929
the same behaviour on parameters, use the C < use parameters :D > pragma
932
930
(currently NYI in Rakudo).
933
931
934
- = head1 Special Variables
932
+ = head1 Special variables
935
933
936
934
Perl 6 attempts to use long, descriptive names for special
937
935
variables. There are only three special variables that are extra
@@ -952,7 +950,7 @@ There are three special variables that are available in every block:
952
950
= end table
953
951
954
952
X < |topic variable >
955
- = head3 The C < $_ > Variable
953
+ = head3 The C < $_ > variable
956
954
957
955
C < $_ > is the topic variable. It's the default parameter for blocks that do
958
956
not have an explicit signature, so constructs like C < for @array { ... } > and
@@ -985,7 +983,7 @@ work on C<$_>:
985
983
# ij*»
986
984
987
985
X < |match variable >
988
- = head3 The C < $/ > Variable
986
+ = head3 The C < $/ > variable
989
987
990
988
C < $/ > is the match variable. It stores the result of the last
991
989
L < Regex|/language/regexes >
@@ -1015,7 +1013,7 @@ say $/;
1015
1013
# textnode => 「some text」»
1016
1014
= end code
1017
1015
1018
- = head4 X « Positional Attributes |variable,$0;variable,$1;variable,@() »
1016
+ = head4 X « Positional attributes |variable,$0;variable,$1;variable,@() »
1019
1017
1020
1018
C < $/ > can have positional attributes if the L < Regex|/language/regexes > had
1021
1019
capture-groups in it, which are just formed with parentheses.
@@ -1034,7 +1032,7 @@ C<@()> can be used.
1034
1032
1035
1033
say @().join; # OUTPUT: «bbbbbdddddeff»
1036
1034
1037
- = head4 X « Named Attributes |variable,$<named>;variable,%() »
1035
+ = head4 X « Named attributes |variable,$<named>;variable,%() »
1038
1036
1039
1037
C < $/ > can have named attributes if the L < Regex|/language/regexes > had named
1040
1038
capture-groups in it, or if the Regex called out to another Regex.
@@ -1054,7 +1052,7 @@ be used.
1054
1052
say %().join; # OUTPUT: «"punctuation ....final-word see?"»
1055
1053
1056
1054
X < |error variable >
1057
- = head3 The C < $! > Variable
1055
+ = head3 The C < $! > variable
1058
1056
1059
1057
C < $! > is the error variable. If a C < try > block or statement prefix catches
1060
1058
an exception, that exception is stored in C < $! > . If no exception was caught,
@@ -1162,7 +1160,7 @@ C<:bin> will be set on the L<IO::ArgFiles> object.
1162
1160
Arguments from the command line.
1163
1161
1164
1162
X < |$*IN > X < |$*OUT > X < |$*ERR >
1165
- = head3 Special Filehandles: STDIN, STDOUT and STDERR
1163
+ = head3 Special filehandles: C < STDIN > , C < STDOUT > and C < STDERR >
1166
1164
1167
1165
For more information about special filehandles please see also the L < Input and
1168
1166
Output|/language/io > page and the L < IO::Special > class. L < IO::Handle > contains
@@ -1178,7 +1176,7 @@ Standard output filehandle, AKA I<STDOUT>.
1178
1176
= item C < $*ERR >
1179
1177
Standard error filehandle, AKA I < STDERR > .
1180
1178
1181
- = head3 Runtime Environment
1179
+ = head3 Runtime environment
1182
1180
X < |%*ENV >
1183
1181
= item C < %*ENV >
1184
1182
Environment variables;
@@ -1323,7 +1321,7 @@ default changed before using them:
1323
1321
1324
1322
This behavior is not tested in the spec tests and is subject to change.
1325
1323
1326
- = head1 Naming Conventions
1324
+ = head1 Naming conventions
1327
1325
1328
1326
It is helpful to know our naming conventions in order to understand what codes
1329
1327
do directly. However, there is not yet a conventions list covering anywhere.
0 commit comments