News for hackers. Stuff that matters.
Re:Don't Use Booleans by nivertech on Tuesday July 09, 2024 @10:21PM (#40923187)
Option/Maybe/Result is a Boolean in disguise.

It has the same problem as Booleans by supporting only two branches: single happy path and single unhappy path, when real life may have many paths, and it’s not always clear which of them are happy or unhappy (from the business logic point of view).

Even for purely technical errors, simple OK | ERROR isn’t enough, but should be something like OK | RETRY | UKNOWN_ERROR | FAILED.

Re:Don't Use Booleans by hardwaresofton on Tuesday July 09, 2024 @10:48PM (#40923288)
Yup, definitely a case for enums there -- I don't think the rule is absolute (I'm not sure you should always use enums over booleans), but much of the time it seems to be true.