Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clarification about @*ARGS closes #2790
  • Loading branch information
JJ committed May 12, 2019
1 parent 098f2c4 commit a7c52cd
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions doc/Language/variables.pod6
Expand Up @@ -56,7 +56,8 @@ declaration of the variable. Assuming we have a C<FailHash> class:
class FailHash is Hash {
has Bool $!final = False;
multi method AT-KEY ( ::?CLASS:D: Str:D \key ){
fail X::OutOfRange.new(:what("Hash key"), :got(key), :range(self.keys)) if $!final && !self.EXISTS-KEY(key);
fail X::OutOfRange.new(:what("Hash key"), :got(key),
:range(self.keys)) if $!final && !self.EXISTS-KEY(key);
callsame # still not final, so do normal action from Hash
}
Expand Down Expand Up @@ -94,8 +95,8 @@ Item assignment places the value from the right-hand side into the variable
List assignment leaves the choice of what to do to the variable on the left.
For example, L<Array|/type/Array> variables (C<@> sigil) empty themselves on list
assignment and then put all the values from the right-hand side into
For example, L<Array|/type/Array> variables (C<@> sigil) empty themselves on
list assignment and then put all the values from the right-hand side into
themselves.
The type of assignment (item or list) is decided by the first context
Expand Down Expand Up @@ -799,7 +800,8 @@ array.
=head3 The C<%> variable
In addition, there's an L<Associative|/type/Associative> anonymous state variable C<%>.
In addition, there's an L<Associative|/type/Associative> anonymous state
variable C<%>.
sub foo($x) {
say (%).push($x => $x);
Expand Down Expand Up @@ -932,7 +934,8 @@ L<of|/type/Variable#trait_of> to set a type constraint.
my Int $x = 42;
$x = 'a string';
CATCH { default { put .^name, ': ', .Str } }
# OUTPUT: «X::TypeCheck::Assignment: Type check failed in assignment to $x; expected Int but got Str ("a string")␤»
# OUTPUT: «X::TypeCheck::Assignment: Type check failed in assignment to $x;
expected Int but got Str ("a string")␤»
If a scalar variable has a type constraint but no initial value, it's
initialized with the type object of the default value of the container it's
Expand Down Expand Up @@ -961,8 +964,9 @@ re-applied by assigning C<Nil> to it:
=head2 Default defined variables pragma
To force all variables to have a L<definiteness|/language/mop#index-entry-syntax_DEFINITE-DEFINITE>
constraint, use the pragma C<use variables :D>. The pragma is lexically scoped and can be
To force all variables to have a
L<definiteness|/language/mop#index-entry-syntax_DEFINITE-DEFINITE> constraint,
use the pragma C<use variables :D>. The pragma is lexically scoped and can be
switched off with C<use variables :_>.
=begin code :skip-test<compile-time error>
Expand Down Expand Up @@ -1267,7 +1271,7 @@ for examples and more context.
=head4 C<@*ARGS>
C<@*ARGS> contains the arguments from the command line.
C<@*ARGS> is an array of C<Str> containing the arguments from the command line.
X<|&*ARGS-TO-CAPTURE>
=head4 C<&*ARGS-TO-CAPTURE>
Expand Down Expand Up @@ -1329,8 +1333,8 @@ in your program.
X<|$*TZ>
=head4 C<$*TZ>
C<$*TZ> contains the system's local time zone offset, as the number of B<seconds>
from GMT.
C<$*TZ> contains the system's local time zone offset, as the number of
B<seconds> from GMT.
X<|$*CWD>
=head4 C<$*CWD>
Expand Down Expand Up @@ -1515,13 +1519,14 @@ C<1e-15>.
X<|$*THREAD>
=head4 C<$*THREAD>
Contains a L<Thread|/type/Thread> object representing the currently executing thread.
Contains a L<Thread|/type/Thread> object representing the currently executing
thread.
X<|$*SCHEDULER>
=head4 C<$*SCHEDULER>
This is a L<ThreadPoolScheduler|/type/ThreadPoolScheduler> object representing the current default
scheduler.
This is a L<ThreadPoolScheduler|/type/ThreadPoolScheduler> object representing
the current default scheduler.
By default this imposes a maximum of 64 threads on the methods C<.hyper>,
C<.race> and other thread-pool classes that use that scheduler such as
Expand Down

0 comments on commit a7c52cd

Please sign in to comment.