Skip to content

Commit 0b82fdd

Browse files
authored
Bool.succ, .pred methods explained (please review)
I first encountered the method "succ" today, and it was a method on Bool. At first I misunderstood it to mean "success", and wondered what type of failure or disaster "pred" stood for. Then I discovered that "succ" means "successor" and "pred" means "predecessor" and that they seem to totally make sense if we think of Bool in terms of it consisting of two possible enums. So, that's what I tried to explain, but I would really like someone that feels more comfortable with this topic to please review my proposed changes (and please improve them if needed), before merging this pull request. (I could have committed directly, but I wanted someone to review this first.)
1 parent dc85695 commit 0b82fdd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

doc/Type/Bool.pod6

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Returns C<True>.
1919
say True.succ; # True
2020
say False.succ; # True
2121
22+
succ is short for successor. In many languages, the succ function is used to return the "next" enum, also known as the successor. Bool is a special enum with only two values, C<False> and C<True>. When sorted, C<False> comes first, so C<True> is its successor. And since C<True> is the "highest" Bool enum, its own successor is also C<True>.
23+
2224
=head2 routine pred
2325
2426
method pred() returns Bool:D
@@ -28,6 +30,8 @@ Returns C<False>.
2830
say True.pred; # False
2931
say False.pred; # False
3032
33+
pred is short for predecessor. In many languages, the pred function is used to return the "previous" enum, also known as the predecessor. Bool is a special enum with only two values, C<False> and C<True>. When sorted, C<False> comes first, so C<False> is the predecessor to C<True>. And since C<False> is the "loweset" Bool enum, its own predecessor is also C<False>.
34+
3135
=head2 routine enums
3236
3337
method enums() returns Hash:D

0 commit comments

Comments
 (0)