Skip to content

Commit 6735868

Browse files
stonedJJ
authored andcommitted
Update Parameter.name and add example, ref #3580
1 parent cbbdb3b commit 6735868

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

doc/Type/Parameter.pod6

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ on what most of the concepts related to parameters mean.
2222

2323
=head2 method name
2424

25+
Defined as:
26+
27+
method name(Parameter:D: --> Str:D)
28+
2529
Returns the variable name, which includes
2630
all L<sigils|/language/variables#Sigils> and
2731
L<twigils|/language/variables#Twigils>.
@@ -31,7 +35,15 @@ usable by a caller – if it is, it will also appear as an
3135
L<alias|#method named_names>. Often, the name will be chosen descriptively
3236
as a form of self-documentation.
3337

34-
If the parameter is anonymous, C<Nil> will be returned.
38+
If the parameter is anonymous, an empty string will be returned.
39+
40+
B<Note:> Before Rakudo version 2020.08 the return value for an anonymous
41+
parameter was C<Nil>.
42+
43+
=for code
44+
my Signature $sig = :(Str $x, Bool);
45+
say $sig.params[0].name; # OUTPUT: «$x␤»
46+
say $sig.params[1].name; # OUTPUT: «␤»
3547

3648
=head2 method sigil
3749

0 commit comments

Comments
 (0)