File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -551,8 +551,12 @@ variable name:
551
551
552
552
Aliases are also possible that way:
553
553
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 >
556
560
557
561
A function with named arguments can be called dynamically, dereferencing a
558
562
L < Pair|/type/Pair > with C < | > to turn it into a named argument.
You can’t perform that action at this time.
0 commit comments