@@ -221,27 +221,27 @@ I<Note:> So far, if you use rakudo perl6, the example below cannot run
221
221
correctly in the REPL. Please test it by copy-pasting it into a file, then
222
222
run the file.
223
223
224
- = begin code
225
- my $lexical = 1;
226
- my $*dynamic1 = 10;
227
- my $*dynamic2 = 100;
224
+ = begin code
225
+ my $lexical = 1;
226
+ my $*dynamic1 = 10;
227
+ my $*dynamic2 = 100;
228
228
229
- sub say-all() {
230
- say "$lexical, $*dynamic1, $*dynamic2";
231
- }
229
+ sub say-all() {
230
+ say "$lexical, $*dynamic1, $*dynamic2";
231
+ }
232
232
233
- say-all(); # OUTPUT: 1, 10, 100
233
+ say-all(); # OUTPUT: 1, 10, 100
234
234
235
- {
236
- my $lexical = 2;
237
- my $*dynamic1 = 11;
238
- $*dynamic2 = 101;
235
+ {
236
+ my $lexical = 2;
237
+ my $*dynamic1 = 11;
238
+ $*dynamic2 = 101;
239
239
240
- say-all(); # OUTPUT: 1, 11, 101
241
- }
240
+ say-all(); # OUTPUT: 1, 11, 101
241
+ }
242
242
243
- say-all(); # OUTPUT: 1, 10, 101
244
- = end code
243
+ say-all(); # OUTPUT: 1, 10, 101
244
+ = end code
245
245
246
246
The first time C < &say-all > is called, it prints "C < 1, 10, 100 > " just as one
247
247
would expect. The second time though, it prints "C < 1, 11, 101 > ". This is
@@ -259,17 +259,17 @@ runtime L<failure|/type/Failure>, so a dynamic variable can be used
259
259
undeclared as long as it's checked for definedness or used in a
260
260
boolean context before using it for anything else:
261
261
262
- = begin code
263
- sub foo() {
264
- $*FOO // 'foo';
265
- }
262
+ = begin code
263
+ sub foo() {
264
+ $*FOO // 'foo';
265
+ }
266
266
267
- say foo; # OUTPUT: «foo»
267
+ say foo; # OUTPUT: «foo»
268
268
269
- my $*FOO = 'bar';
269
+ my $*FOO = 'bar';
270
270
271
- say foo; # OUTPUT: «bar»
272
- = end code
271
+ say foo; # OUTPUT: «bar»
272
+ = end code
273
273
274
274
Dynamic variables can have lexical scope when declared with C < my > or package
275
275
scope when declared with C < our > . Dynamic resolution and resolution through
@@ -1120,9 +1120,10 @@ This I<magic> behavior of C<@()> has been deprecated as of 6.d
1120
1120
C < $/ > can have named attributes if the L < Regex|/language/regexes > had named
1121
1121
capture-groups in it, or if the Regex called out to another Regex.
1122
1122
1123
- 'I... see?' ~~ / \w+ $<punctuation>=[ <-[\w\s]>+ ] \s* $<final-word> = [ \w+ . ] /;
1124
- say $/<punctuation>; # OUTPUT: «「....」»
1125
- say $/<final-word>; # OUTPUT: «「see?」»
1123
+ = for code
1124
+ 'I... see?' ~~ / \w+ $<punctuation>=[ <-[\w\s]>+ ] \s* $<final-word> = [ \w+ . ] /;
1125
+ say $/<punctuation>; # OUTPUT: «「....」»
1126
+ say $/<final-word>; # OUTPUT: «「see?」»
1126
1127
1127
1128
These can also be accessed by the shortcut C « $<named> » .
1128
1129
@@ -1512,13 +1513,6 @@ X<|$*TMPDIR>
1512
1513
This is an L < IO::Path > object representing the "system temporary directory" as
1513
1514
determined by L « C < .tmpdir IO::Spec::* method > |/routine/tmpdir» .
1514
1515
1515
- X < |$*TOLERANCE >
1516
- = head4 C < $*TOLERANCE >
1517
-
1518
- Variable used by the L < C < =~= > |/routine/=~=> operator, and any operations that
1519
- depend on it, to decide if two values are approximately equal. Defaults to
1520
- C < 1e-15 > .
1521
-
1522
1516
X < |$*THREAD >
1523
1517
= head4 C < $*THREAD >
1524
1518
@@ -1561,12 +1555,30 @@ sub MAIN($a, :$b, UInt :$ehehe) {
1561
1555
1562
1556
It is accessible only inside of MAIN sub.
1563
1557
1558
+ = head3 Runtime variables
1559
+
1560
+ These variables affect the behavior of certain functions, and in some cases its
1561
+ value can be changed during runtime.
1562
+
1564
1563
X < |$*COLLATION >
1565
1564
= head4 C < $*COLLATION >
1566
1565
1567
1566
This is a L < Collation|/type/Collation > object that can be used to
1568
1567
configure Unicode collation levels.
1569
1568
1569
+ X < |$*TOLERANCE >
1570
+ = head4 C < $*TOLERANCE >
1571
+
1572
+ Variable used by the L < C < =~= > |/routine/=~=> operator, and any operations that
1573
+ depend on it, to decide if two values are approximately equal. Defaults to
1574
+ C < 1e-15 > .
1575
+
1576
+ X < |$*DEFAULT-READ-ELEMS >
1577
+ = head4 C < $*DEFAULT-READ-ELEMS >
1578
+
1579
+ Affects the number of bytes read by default by
1580
+ L < C < IO::Handle.read > |/type/IO::Handle#method_read> . Its default value is 65536.
1581
+
1570
1582
= head1 Naming conventions
1571
1583
1572
1584
It is helpful to know our naming conventions in order to understand what codes
0 commit comments