|
Boost : |
From: Rainer Deyke (rdeyke_at_[hidden])
Date: 2025-01-07 15:16:48
On 06.01.25 19:43, Ivan Matek via Boost wrote:
> As I said I agree with regards to =>. In regards to boost::implies vs !a ||
> b my belief is that it heavily depends on the person. For me (and I
> presume many others even if we are not majority) even after many years of
> programming if I saw something like
> boost::implies(student.graduaded(), student.num_active_courses() == 0)
> reads much much nicer than
> !student.graduaded() || student.num_active_courses() == 0
The problem here is that your example is closer to the English usage of
the word "implies" than to the usage in boolean logic that we are
talking about. "A implies B" in English usually means that there is a
logical connection such that B is necessarily true if A is true. For
example, a student who has graduated necessarily has no active courses.
"A => B" merely means that either A is false or B is true. For example,
"I am the president of the United States => there is world peace" is
trivially true because I am not the president of the United States, even
though if I would almost certainly be unable to achieve world peace even
if I were the president of the United States. The C++ expression "!A ||
B" is actually closer to the correct English than "A => B" for
expressing this condition.
-- Rainer Deyke - rainerd_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk