Skip to content

Commit 1f30c68

Browse files
committedSep 28, 2016
clarify what arguments are defined in what where-clause
1 parent 7de9973 commit 1f30c68

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
 

‎doc/Type/Signature.pod6

+11
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ The first of those can be shortened to
138138
i.e., you can use a literal directly as a type and value constraint
139139
on an anonymous parameter.
140140
141+
Any argument in a C<Signature> is declared in a C<where>-clause that is
142+
following that argument. Therefor, the C<where>-clause of the last argument got
143+
access to all arguments of a signature that are not part of a sub-signature.
144+
For sub-signature place the C<where>-clause inside the sub-signature.
145+
146+
sub one-of-them(:$a, :$b, :$c where { $a.defined ^^ $b.defined ^^ $c.defined } ) {
147+
$a // $b // $c
148+
};
149+
say one-of-them(c=>42);
150+
# OUTPUT«42␤»
151+
141152
=head3 Constraining Slurpy Arguments
142153
143154
L<Slurpy arguments|Slurpy_(A.K.A._Variadic)_Parameters> can not have type

0 commit comments

Comments
 (0)
Please sign in to comment.