Skip to content

Commit

Permalink
clarify what arguments are defined in what where-clause
Browse files Browse the repository at this point in the history
  • Loading branch information
gfldex committed Sep 28, 2016
1 parent 7de9973 commit 1f30c68
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/Type/Signature.pod6
Expand Up @@ -138,6 +138,17 @@ The first of those can be shortened to
i.e., you can use a literal directly as a type and value constraint
on an anonymous parameter.
Any argument in a C<Signature> is declared in a C<where>-clause that is
following that argument. Therefor, the C<where>-clause of the last argument got
access to all arguments of a signature that are not part of a sub-signature.
For sub-signature place the C<where>-clause inside the sub-signature.
sub one-of-them(:$a, :$b, :$c where { $a.defined ^^ $b.defined ^^ $c.defined } ) {
$a // $b // $c
};
say one-of-them(c=>42);
# OUTPUT«42␤»
=head3 Constraining Slurpy Arguments
L<Slurpy arguments|Slurpy_(A.K.A._Variadic)_Parameters> can not have type
Expand Down

0 comments on commit 1f30c68

Please sign in to comment.