Skip to content
Permalink
Browse files

Minor typographic changes and reflow

  • Loading branch information...
JJ committed May 18, 2019
1 parent dd9f225 commit f668fa0c2aff35574ac0bbd1c3b2ebbae98052c6
Showing with 20 additions and 18 deletions.
  1. +20 −18 doc/Language/variables.pod6
@@ -34,12 +34,12 @@ simplify assignment by flattening by default.
=begin table
Sigil Type constraint Default type Assignment Examples
===== =============== ============ ========== ========
$ Mu (no type constraint) Any item Int, Str, Array, Hash
@ Positional Array list List, Array, Range, Buf
% Associative Hash list Hash, Map, Pair
& Callable Callable item Sub, Method, Block, Routine
Sigil Type constraint Default type Assignment Examples
===== =============== ============ ========== ========
$ Mu (no type constraint) Any item Int, Str, Array, Hash
@ Positional Array list List, Array, Range, Buf
% Associative Hash list Hash, Map, Pair
& Callable Callable item Sub, Method, Block, Routine
=end table
@@ -66,7 +66,7 @@ declaration of the variable. Assuming we have a C<FailHash> class:
}
}
One can then define a C<%h> variable using C<is>:
One can then define a C<%h> variable of this type using C<is>:
=for code :preamble<class FailHash {}>
my %h is FailHash = oranges => "round", bananas => "bendy";
@@ -1016,9 +1016,10 @@ There are three special variables that are available in every block:
X<|topic variable>
=head3 The C<$_> variable
C<$_> is the topic variable. It's the default parameter for blocks that do
not have an explicit signature, so constructs like C<for @array { ... }> and
C<given $var { ... }> bind to C<$_> by invoking the block.
C<$_> is the topic variable. It's the default parameter for blocks that do not
have an explicit signature, so constructs like C<for @array { ... }> and C<given
$var { ... }> bind the value or values of the variable to C<$_> by invoking the
block.
for <a b c> { say $_ } # sets $_ to 'a', 'b' and 'c' in turn
say $_ for <a b c>; # same, even though it's not a block
@@ -1103,7 +1104,8 @@ These can also be accessed by the shortcuts C<$0>, C<$1>, C<$2>, etc.
say $0; # OUTPUT: «「bbbbb」␤»
say $1; # OUTPUT: «「dddddeff」␤»
To get all of the positional attributes, you can use C<$/.list> or C<@$/>. Before 6.d, you can also use the C<@()> shortcut (no spaces inside the
To get all of the positional attributes, you can use C<$/.list> or C<@$/>.
Before 6.d, you can also use the C<@()> shortcut (no spaces inside the
parentheses).
say @$/.join; # OUTPUT: «bbbbbdddddeff␤»
@@ -1118,7 +1120,7 @@ This I<magic> behavior of C<@()> has been deprecated as of 6.d
C<$/> can have named attributes if the L<Regex|/language/regexes> had named
capture-groups in it, or if the Regex called out to another Regex.
'I.... see?' ~~ / \w+ $<punctuation>=[ <-[\w\s]>+ ] \s* $<final-word> = [ \w+ . ] /;
'I... see?' ~~ / \w+ $<punctuation>=[ <-[\w\s]>+ ] \s* $<final-word> = [ \w+ . ] /;
say $/<punctuation>; # OUTPUT: «「....」␤»
say $/<final-word>; # OUTPUT: «「see?」␤»
@@ -1182,7 +1184,8 @@ The following compile time variables allow for a deeper introspection:
$?NL What a vertical newline "\n" means: LF, CR or CRLF
$?DISTRIBUTION The Distribution of the current compilation unit.
With particular regard to the C<$?NL>, see the L<newline pragma|/language/pragmas>.
With particular regard to the C<$?NL>, see the L<newline
pragma|/language/pragmas>.
These variables are Rakudo specific, with all the corresponding caveats:
=for table
@@ -1325,11 +1328,10 @@ This variable holds information about modules installed/loaded.
X<|$*INIT-INSTANT>
=head4 C<$*INIT-INSTANT>
C<$*INIT-INSTANT> is an L<Instant|/type/Instant> object representing program startup time.
In particular, this is when the core code starts up,
so the value of C<$*INIT-INSTANT> may be a few milliseconds
earlier than C<INIT now> or even C<BEGIN now> executed
in your program.
C<$*INIT-INSTANT> is an L<Instant|/type/Instant> object representing program
startup time. In particular, this is when the core code starts up, so the value
of C<$*INIT-INSTANT> may be a few milliseconds earlier than C<INIT now> or even
C<BEGIN now> executed in your program.
X<|$*TZ>
=head4 C<$*TZ>

0 comments on commit f668fa0

Please sign in to comment.
You can’t perform that action at this time.