|
Boost : |
Subject: Re: [boost] Ternary logic programming (was: Re: [variant] Maintainer)
From: charleyb123 . (charleyb123_at_[hidden])
Date: 2015-07-02 14:09:16
>
> <snip>,
>
But that's for something like expected<T,E>. For optional<T>, empty
> currently maps to false, at least in boost::optional and
> std::experimental::optional. In a functional language with "Maybe T",
> empty really does map better to unknown - I do not yet know the value
> of T. We force it into boolean because that's what we are comfortable
> with.
>
> Hmmm, optional<bool> would have less problems if empty mapped to
> unknown instead of false.
>
> Tony
>
Bingo.
bool forces us into false dilemmas. It's even worse when the
"forced-conversion" could legitimately be either "true" or "false" for
different reasons, and for different scenarios. It's even worse when this
is done silently.
The result is un-handled (and hidden) corner-cases, bad logic, bad
reasoning, and ultimately bad APIs.
You need "one-more-dimension" to talk about the dimension-below, so by this
reasoning, only ternary (and above) can be self-reflective. (Consistent
and logical.)
Simply stated: The most atomic level of real-world reasoning is a
true/false bit with an attached "property" of "unknown". No smaller atom
exists.
(Coercing this atom to "true/false" from "true/false/unknown" is asserted
to be "error-injection" into the system, which has no legitimate place in
logic.)
Boole's book, "The Laws of Thought" is based on assumptions that are
constantly violated in real-world systems. When you place those
very-clearly-stated assumptions underlying bivalent logic on the wall, the
impossibility of reasoning in boolean becomes obvious.
</rant> ;-))
--charley
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk