I believe boost::tribool addresses exactly this point.
- Rob.
On 3 July 2015 at 10:45, Bjorn Reese
On 07/02/2015 02:49 AM, Niall Douglas wrote:
Out of interest, what do you think of my free function ternary logic
programming:
So far, the discussion has focussed on how the ternary operators should behave in if-statements. In that case, I tend to agree with Lee's enum and switch suggestion, which also extends well into multi-variate logic.
If we want to use the ternary logic in if-statements, then we should address composite conditions. For instance, what should the following evaluate to?
if (Empty && Value) {}
if (Empty && Error) {}
if (Empty && Empty) {}
The question really boils done to what influence Empty has. Do we want it to influence the results, or should it act like a "don't care" value?
PS: Niall, I know that you are currently using Kleene logic, but I think that it is worthwhile to consider the use-cases before selecting the truth tables.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- ACCU - Professionalism in programming - http://www.accu.org