Skip to content

Commit 8c4bd04

Browse files
committed
Actions(stub)/Adverbial Pair/Argument/Parameter
1 parent e89affa commit 8c4bd04

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

doc/Language/glossary.pod

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ implemented using L<roles|Role> with L<stubbed|Stub> methods.
1818
method bark { say "woof" } # *MUST* be implemented by class
1919
}
2020
21+
=head1 Actions
22+
2123
=head1 Advent Calendar
2224
2325
In the context of Perl 6, a yearly set of blog posts for each day from
@@ -48,6 +50,21 @@ followed by a name (for the key):
4850
4951
Also see L<Colon Pair and Colon List>.
5052
53+
=head1 Adverbial Pair
54+
55+
A generalized form of L</pair notation>. They all start with the colon, like:
56+
57+
adverbial pair | pair notation
58+
================|==============
59+
:foo<bar> | foo => 'bar'
60+
:foo(42) | foo => 42
61+
:42foo | foo => 42
62+
:$foo | foo => $foo
63+
:foo | foo => True
64+
:!foo | foo => False
65+
66+
Also see L</Adverb> and L</Colon Pair and Colon List>.
67+
5168
=head1 Anonymous
5269
5370
A subroutine, method or submethod is called I<anonymous> if it can't be
@@ -59,7 +76,8 @@ called by name.
5976
# anonymous subroutine, stored in a named scalar
6077
my $double = sub ($x) { 2 * $x };
6178
62-
Note that it is still allowed to have a name
79+
Note that it is still allowed to have a name, but you cannot call it by
80+
that name:
6381
6482
# anonymous, but knows its own name
6583
my $s = anon sub triple($x) { 3 * $x }
@@ -91,6 +109,26 @@ initial barrage of RFC's that came out of the Perl community. Now only kept
91109
as an historical document for reference. See also L<Exegesis> and
92110
L<Synopsis>.
93111
112+
=head1 Argument
113+
114+
A value that you pass on to a L<subroutine|Subroutine>, L<method|Method>
115+
or a L<callable block|Callable>. As opposed to the L<Parameter> that is
116+
specified in the definition of a subroutine/method/callable block.
117+
118+
sub foo($bar) { say $bar } # $bar is a parameter
119+
foo(42); # 42 is an argument
120+
121+
=head1 Array
122+
123+
L<Array|/type/Array> is a subclass of L<List|/type/List> that is mutable.
124+
This means you can e.g. C<.push> and C<.pop> on an array, whereas you cannot
125+
do that on a list. This is separate from the type of elements in the array:
126+
if they are containers, then they are also mutable, but they don't have to
127+
be. Arrays are typically recognizable by the L<@> L<sigil|Sigil>.
128+
129+
my @array = 1,2,3;
130+
say @a; # [1 2 3]
131+
94132
=head1 Arity
95133
96134
The number of L<positional|Positional> operands expected by an
@@ -485,6 +523,8 @@ Examples of things that are not lvalues:
485523
sub f { }; f(); # "normal" subs are not writable
486524
sub f($x) { $x = 3 }; # error - parameters are read-only by default
487525
526+
These are typically called L<rvalues|rvalue>.
527+
488528
=head1 Mainline
489529
490530
The C<mainline> is the program text that is not part of any kind of block.
@@ -504,6 +544,16 @@ pre-compiled file).
504544
505545
See L<Attribute>.
506546
547+
=head1 Parameter
548+
549+
L<Parameter|/type/Parameter> is a class to define parameters to
550+
L<subroutines|Subroutine>, L<methods|Method> and a L<callable blocks|Callable>.
551+
As opposed to the L<arguments|Argument> you specify when calling a
552+
subroutine/method/callable block.
553+
554+
sub foo($bar) { say $bar } # $bar is a parameter
555+
foo(42); # 42 is an argument
556+
507557
=head1 Property
508558
509559
See L<Attribute>.

0 commit comments

Comments
 (0)