Skip to content

Commit 3b12be9

Browse files
authored
Rewrite example of alias named signature
1 parent 12ec0ca commit 3b12be9

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

doc/Type/Signature.pod6

Lines changed: 7 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 aliase-named(:color(:$colour), :type(:class(:$kind))) { say $colour ~ " " ~ $kind }
555+
aliase-named(color => "red", type => "A"); # both name can be use
556+
aliase-named(colour => "green", type => "B"); # more than two name is ok
557+
aliase-named(color => "white", class => "C"); # every alias is independent
558+
559+
More use of alias 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.
@@ -784,3 +788,4 @@ Defined as:
784788
Throws C<X::Cannot::Capture>.
785789
786790
=end pod
791+

0 commit comments

Comments
 (0)