Skip to content

Commit 98301ac

Browse files
committed
Add documentation for Signature.new
1 parent 4830298 commit 98301ac

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

doc/Type/Signature.pod6

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,6 +1048,35 @@ Defined as:
10481048
10491049
Throws C<X::Cannot::Capture>.
10501050
1051+
=head1 Runtime creation of Signature objects (6.d, 2019.01 and later)
1052+
1053+
Signature.new(params => (...), returns => Type, arity => 1, count => 1)
1054+
1055+
In some situations, specifically when working with the MetaObject Protocol,
1056+
it makes sense to create C<Signature> objects programmatically. For this
1057+
purpose, you can call the C<new> method with the following named parameters:
1058+
1059+
=item params
1060+
1061+
A list of L<Parameter|/type/Parameter> objects for this signature.
1062+
1063+
=item returns
1064+
1065+
Any constraint the return value should match. Defaults to C<Mu>, which
1066+
effectively implies no return value constraint check.
1067+
1068+
=item arity
1069+
1070+
The I<minimal> number of positional arguments required to satisfy the
1071+
signature. Defaults to the number of C<Parameter> objects given with
1072+
the C<params> parameter.
1073+
1074+
=item count
1075+
1076+
The I<maximal> number of positional arguments which can be bound to the
1077+
signature. Defaults to the C<arity> if not specified. Specify C<Inf> if
1078+
there is a slurpy positional parameter.
1079+
10511080
=end pod
10521081

10531082
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)