Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add coercion types to signature
  • Loading branch information
gfldex committed Jun 17, 2016
1 parent 1ad7597 commit 79b198d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions doc/Type/Signature.pod
Expand Up @@ -196,6 +196,16 @@ type constraint.
Type captures and coercion types are not supported.
=head3 X<Coercion Type|coercion type (signature)>
To accept one type but coerce it automatically to another, use the accepted
type as an argument to the target type. If the accepted type is C<Any> it can
be obmitted.
sub f(Int(Str) $want-int, Str() $want-str){ say $want-int.WHAT, $want-str.WHAT }
f '10', 10;
# OUTPUT«(Int)(Str)␤»
=head2 X<Slurpy (A.K.A. Variadic) Parameters|parameter,*@;parameter,*%>
An array or hash parameter can be marked as I<slurpy> by leading asterisk(s),
Expand Down

0 comments on commit 79b198d

Please sign in to comment.