Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
reflow and checks for #2632
  • Loading branch information
JJ committed Mar 2, 2019
1 parent 07bafa3 commit 14d90c1
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions doc/Type/Signature.pod6
Expand Up @@ -1013,31 +1013,33 @@ Whatever the Signature's return constraint is:
multi method ACCEPTS(Signature:D: Capture $topic)
multi method ACCEPTS(Signature:D: Mu \topic)
If C<$topic> is a L<Signature|/type/Signature> returns C<True> if anything accepted by C<$topic>
would also be accepted by the invocant, otherwise returns C<False>:
If C<$topic> is a L<Signature|/type/Signature> returns C<True> if anything
accepted by C<$topic> would also be accepted by the invocant, otherwise returns
C<False>:
:($a, $b) ~~ :($foo, $bar, $baz?); # OUTPUT: «True»
:(Int $n) ~~ :(Str); # OUTPUT: «False»
The C<$topic> is a L<Capture|/type/Capture>, returns C<True> if it can be bound to the
invocant, i.e., if a function with invocant's C<Signature> would be able to be
called with the C<$topic>:
The C<$topic> is a L<Capture|/type/Capture>, returns C<True> if it can be bound
to the invocant, i.e., if a function with invocant's C<Signature> would be able
to be called with the C<$topic>:
\(1, 2, :foo) ~~ :($a, $b, :foo($bar)); # OUTPUT: «True»
\(1, :bar) ~~ :($a); # OUTPUT: «False»
Lastly, the candidate with C<Mu> C<topic> converts C<topic> to L<Capture|/type/Capture>
and follows the same semantics as L<Capture|/type/Capture> C<$topic>:
Lastly, the candidate with C<Mu \topic> converts C<topic> to
L<Capture|/type/Capture> and follows the same semantics as
L<Capture|/type/Capture> C<$topic>:
<a b c d> ~~ :(Int $a); # OUTPUT: «False»
42 ~~ :(Int); # OUTPUT: «False» (Int.Capture throws)
set(<a b>) ~~ :(:$a, :$b); # OUTPUT: «True»
Since L«C<where> clauses|/type/Signature#index-entry-where_clause_(Signature)»
are not introspectable, the method cannot determine whether two signatures
L<ACCEPTS|/type/Signature#method_ACCEPTS> the same sort of C<where>-constrained parameters. Such comparisons
will return C<False>. This includes signatures with literals, which are just
sugar for the C<where>-constraints:
L<ACCEPTS|/type/Signature#method_ACCEPTS> the same sort of C<where>-constrained
parameters. Such comparisons will return C<False>. This includes signatures with
literals, which are just sugar for the C<where>-constraints:
say :(42) ~~ :($ where 42) # OUTPUT: «False␤»
Expand Down

0 comments on commit 14d90c1

Please sign in to comment.