Skip to content

Commit

Permalink
Document how to write named arguments that do not create any symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaiepi committed Mar 27, 2020
1 parent f5f90e6 commit 39e569c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/Type/Signature.pod6
Expand Up @@ -885,6 +885,16 @@ say alias-named(color => "red", style => "A");
say alias-named(colour => "green", variety => "B");
say alias-named(color => "white", class => "C");
Using argument aliases, you can create named arguments that do not
create any symbols. This is useful when using named arguments as
sentinels:
=for code
multi sub trait_mod:<is>(Routine:D $r is raw, :timestamped($)!) {
$r does role timestamped { has Instant:D @.timestamps };
$r.wrap: -> | { ENTER $r.timestamps.push: now; callsame };
}
X<|optional argument>
=head2 Optional and mandatory arguments
Expand Down
3 changes: 3 additions & 0 deletions xt/words.pws
Expand Up @@ -1292,6 +1292,9 @@ tiebreaking
timespec
timezoneclash
timezones
timestamp
timestamps
timestamped
timtoady
timtowtdi
titlecase
Expand Down

0 comments on commit 39e569c

Please sign in to comment.