Skip to content

Commit f09992e

Browse files
authored
Merge pull request #1596 from W4anD0eR96/patch-2
Rewrite intro of alias named signature
2 parents 06e8f69 + f208e65 commit f09992e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

doc/Type/Signature.pod6

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,12 @@ variable name:
551551
552552
Aliases are also possible that way:
553553
554-
sub ( :color(:colour($c)) ) { } # 'color' and 'colour' are both OK
555-
sub ( :color(:$colour) ) { } # same API for the caller
554+
sub alias-named(:color(:$colour), :type(:class(:$kind))) { say $colour ~ " " ~ $kind }
555+
alias-named(color => "red", type => "A"); # both names can be used
556+
alias-named(colour => "green", type => "B"); # more than two names are ok
557+
alias-named(color => "white", class => "C"); # every alias is independent
558+
559+
More use of aliases can be found in L<sub MAIN|/language/functions#sub_MAIN>
556560
557561
A function with named arguments can be called dynamically, dereferencing a
558562
L<Pair|/type/Pair> with C<|> to turn it into a named argument.

0 commit comments

Comments
 (0)