You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -882,7 +882,7 @@ successful exit means the block returned a defined value or a list.
882
882
883
883
In the above case, if the C<Bool.pick> returns true, the answer will
884
884
stay as 84 because the block returns a defined value (C<say> returns
885
-
true). Otherwise the C<die> statement will cause the block to exit
885
+
C<True>). Otherwise the C<die> statement will cause the block to exit
886
886
unsuccessfully, resetting the answer to 42.
887
887
888
888
X<|constant (Prefix)>
@@ -896,7 +896,9 @@ constant $pi2 = pi * 2;
896
896
$pi2 = 6; # OUTPUT: «(exit code 1) Cannot assign to an immutable value
897
897
=endcode
898
898
899
-
The value is assigned at compile time. Please check L<the section on constants in the Terms page|/language/terms#Constants> for additional information.
899
+
The value is assigned at compile time. Please check
900
+
L<the section on constants in the Terms page|/language/terms#Constants> for
901
+
additional information.
900
902
901
903
=head1Type constraints and initialization
902
904
@@ -911,7 +913,8 @@ L<of|/type/Variable#trait_of> to set a type constraint.
911
913
# OUTPUT: «X::TypeCheck::Assignment: Type check failed in assignment to $x; expected Int but got Str ("a string")»
912
914
913
915
If a scalar variable has a type constraint but no initial value, it's
914
-
initialized with the type object of the default value of the container it's bound to.
916
+
initialized with the type object of the default value of the container it's
917
+
bound to.
915
918
916
919
my Int $x;
917
920
say $x.^name; # OUTPUT: «Int»
@@ -1201,7 +1204,11 @@ in uppercase.
1201
1204
X<|$*ARGFILES>X<|@*ARGS>
1202
1205
=head3Argument related variables
1203
1206
1204
-
=itemC<$*ARGFILES> An L<IO::ArgFiles> (an empty subclass of L<IO::CatHandle>)
1207
+
These variables are related to the arguments passed to a script.
1208
+
1209
+
=head4C<$*ARGFILES>
1210
+
1211
+
An L<IO::ArgFiles> (an empty subclass of L<IO::CatHandle>)
1205
1212
that uses C<@*ARGS> as source files, if it contains any files, or C<$*IN>
1206
1213
otherwise. When C<$*IN> is used, its C<:nl-in>, C<:chomp>, C<:encoding>, and
1207
1214
C<:bin> will be set on the L<IO::ArgFiles> object.
@@ -1210,8 +1217,9 @@ As of 6.d language, C<$*ARGFILES> I<inside>
1210
1217
L<C«sub MAIN»|/language/functions#sub_MAIN> is always set to C<$*IN>, even
1211
1218
when C<@*ARGS> is not empty.
1212
1219
1213
-
=itemC<@*ARGS>
1214
-
Arguments from the command line.
1220
+
=head4C<@*ARGS>
1221
+
1222
+
C<@*ARGS> contains the arguments from the command line.
1215
1223
1216
1224
X<|$*IN>X<|$*OUT>X<|$*ERR>
1217
1225
=head3Special filehandles: C<STDIN>, C<STDOUT> and C<STDERR>
@@ -1220,7 +1228,6 @@ For more information about special filehandles please see also the L<Input and
1220
1228
Output|/language/io> page and the L<IO::Special> class. L<IO::Handle> contains
1221
1229
several examples of using C<$*IN> for reading standard input.
1222
1230
1223
-
1224
1231
=itemC<$*IN>
1225
1232
Standard input filehandle, AKA I<STDIN>.
1226
1233
@@ -1231,153 +1238,229 @@ Standard output filehandle, AKA I<STDOUT>.
1231
1238
Standard error filehandle, AKA I<STDERR>.
1232
1239
1233
1240
=head3Runtime environment
1241
+
1242
+
These dynamic variables contain information related to the environment the
1243
+
script or program is running in.
1244
+
1234
1245
X<|%*ENV>
1235
-
=itemC<%*ENV>
1236
-
Environment variables. Numeric values are provided
1246
+
=head4C<%*ENV>
1247
+
1248
+
Operating system environment variables. Numeric values are provided
1237
1249
as L<allomorphs|/language/glossary#index-entry-Allomorph>
1238
1250
1239
1251
X<|$*REPO>
1240
-
=itemC<$*REPO>
1241
-
a variable holding information about modules installed/loaded;
1252
+
=head4C<$*REPO>
1253
+
1254
+
This variable holds information about modules installed/loaded.
1242
1255
1243
1256
X<|$*INIT-INSTANT>
1244
-
=itemC<$*INIT-INSTANT>
1245
-
an Instant object representing program startup time.
1257
+
=head4C<$*INIT-INSTANT>
1258
+
1259
+
C<$*INIT-INSTANT> is an L<Instant> object representing program startup time.
1246
1260
In particular, this is when the core code starts up,
1247
1261
so the value of C<$*INIT-INSTANT> may be a few milliseconds
1248
1262
earlier than C<INIT now> or even C<BEGIN now> executed
1249
-
in your program;
1263
+
in your program.
1250
1264
1251
1265
X<|$*TZ>
1252
-
=itemC<$*TZ>
1253
-
the system's local timezone offset, as the number of B<seconds> from GMT;
1266
+
=head4C<$*TZ>
1267
+
1268
+
C<$*TZ> contains the system's local timezone offset, as the number of B<seconds>
1269
+
from GMT.
1254
1270
1255
1271
X<|$*CWD>
1256
-
=itemC<$*CWD>
1257
-
the Current Working Directory;
1272
+
=head4C<$*CWD>
1273
+
1274
+
It contains the Current Working Directory.
1258
1275
1259
1276
X<|$*KERNEL>
1260
-
=itemC<$*KERNEL>
1261
-
the current running Kernel.
1277
+
=head4C<$*KERNEL>
1278
+
1279
+
C<$*KERNEL> contains an object that is stringified to the current running
1280
+
kernel.
1281
+
1282
+
say $*KERNEL; # OUTPUT: «linux (4.4.92.31.default)»
1262
1283
1263
1284
X<|$*DISTRO>
1264
-
=itemC<$*DISTRO>
1285
+
=head4C<$*DISTRO>
1286
+
1265
1287
This object (of type C<Distro>) contains information about the current operating
1266
-
system distribution (e.g. C<say "Some sort of Windows" if $*DISTRO.is-win>); in
1267
-
the current Rakudo implementation, C<$*DISTRO.name> takes the following values
1268
-
(which should be self-explanatory): C<mswin32>, C<macosx>, C<freebsd>, C<linux>,
1269
-
C<netbsd>, C<raspbian> and C<dragonfly>. Since these names are implementation
1270
-
defined and not in the specification, they could vary and change at any moment.
1271
-
C<$*DISTRO> can be stringfied by printing it, for instance, C<say $*DISTRO>, it
1272
-
will show additional information on the operating system and version it's using,
1273
-
like C<OUTPUT: «debian (9.stretch)»>.
1288
+
system distribution. For instance:
1289
+
1290
+
say "Some sort of Windows" if $*DISTRO.is-win;
1291
+
1292
+
C<$*DISTRO.name> takes a set of values that depend on the operating system.
1293
+
These names will vary with version and implementation, so you should
1294
+
double-check and test before using them in your programs; since these names are
1295
+
implementation defined and not in the specification, they could vary and change
1296
+
at any moment.
1297
+
1298
+
C<$*DISTRO> can be stringfied by printing it
1299
+
1300
+
say $*DISTRO; # OUTPUT: «debian (9.stretch)»
1301
+
1302
+
This shows additional information on the operating system and version it's
1303
+
using, but as a matter of fact, this variable contains information which is
1304
+
useful to create portable programs, such as the path separator:
0 commit comments