News for hackers. Stuff that matters.
Re:Evil Coding Incantations by Twisol on Monday December 25, 2017 @04:48PM (#16005858)
There is a real and useful sense in which _everything_ is an integer; see Godel numbering. There's also a real and (debatably) useful sense in mathematics in which everything is a set. Even still, we prefer to impose structure and convention because it helps us understand what's going on, by restricting the kinds of things we need to be able to expect.

Booleans are the same kind of thing. We don't normally do arithmetic on them; at most we might treat `bool` like Z-mod-2. But Z-mod-2 behaves very differently from `int`.

Re:Evil Coding Incantations by Y_Y on Monday December 25, 2017 @04:59PM (#16005905)
I'd love to hear of a case where anyone has actually computed a Goedel number.

We very often do arithmetic on booleans, the a canonical homomorphism (Iverson bracket) with 1 ~ True and 0 ~ False where && and || are multiplication and addition. But I guess you knew that.

Re:Evil Coding Incantations by yorwba on Monday December 25, 2017 @07:18PM (#16006330)
That is not the only homomorphism. You could just as well have 0 ~ True and 1 ~ False, where && and || are addition and multiplication. Booleans don't have enough algebraic structure to nail down a unique embedding. Integers and reals don't have the same problem, because there's a unique ring homomorphism between them.
Re:Evil Coding Incantations by catnaroek on Monday December 25, 2017 @10:02PM (#16006819)
Blessing noncanonical structures and mappings is indeed evil. Let's take this to its logical conclusion and banish type classes.
Re:Evil Coding Incantations by yorwba on Monday December 25, 2017 @11:55PM (#16007150)
I'm not sure what you mean by that. Type classes are all about making canonical structures explicit.
Re:Evil Coding Incantations by catnaroek on Tuesday December 26, 2017 @07:56AM (#16008394)
Type class instances are only “canonical” by fiat. Once you elaborate type classes into record-passing, by no means are the resulting instance types uniquely inhabited.

This is just as bad as the existence of truthy or falsy values.