Skip to content

Commit

Permalink
(Attempt to) clarify Pair.ACCEPTS (refs #2622).
Browse files Browse the repository at this point in the history
  • Loading branch information
cfa committed Feb 24, 2019
1 parent 76c40f7 commit 6de08e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions doc/Type/Pair.pod6
Expand Up @@ -130,9 +130,16 @@ be different:
say :42z ~~ :42a; # OUTPUT: «True␤»
say :10z ~~ :42a; # OUTPUT: «False␤»
If C<$topic> is any other value, uses the invocant's key as the name of the
method to call on C<$topic> and checks that its L«C<.Bool>|/routine/Bool» is the same
as C<.Bool> of the invocant's value. This form can be used to check
If C<$topic> is any other value, the invocant C<Pair>'s key is treated as a method name.
This method is called on C<$topic>, the L«boolean|/routine/Bool» result of which is compared
against the the invocant C<Pair>'s L«boolean|/routine/Bool» value. For example, primality can
be tested using smartmatch:
say 3 ~~ :is-prime; # OUTPUT: «True␤»
say 3 ~~ is-prime => 'truthy'; # OUTPUT: «True␤»
say 4 ~~ :is-prime; # OUTPUT: «False␤»
This form can also be used to check
L<Bool|/type/Bool> values of multiple methods on the same object, such as
L<IO::Path>, by using L<Junctions|/type/Junction>:
Expand Down
1 change: 1 addition & 0 deletions xt/words.pws
Expand Up @@ -970,6 +970,7 @@ prepended
prepends
prepost
prev
primality
printf
privatemethodcontainer
proc
Expand Down

0 comments on commit 6de08e3

Please sign in to comment.