logoalt Hacker News

tacitusarc • today at 12:58 AM • 1 reply • view on HN

Booleans are reductionist and likely harmful, as they allow programmers to avoid thinking in terms of the test they are actually performing: is this a member of some set? If the problem is reworked like that Booleans are superfluous (this representation could be compiled to something as performant as using Booleans).

I am not sure if that perspective aligns with yours.


Replies

zephen • today at 6:04 AM

Not sure why you're getting downvoted so much, but to put this thought into a somewhat broader context:

In an explicitly, statically typed language, bools might be useful as a standard small enum.

In what Python used to be, they weren't, not really.

But for whatever reason, declared typing is now an add-on to the language, and the people who like the verbosity of declared typing also, perhaps schizophrenically, like the terseness afforded by having a standard small enum.