
Boost : 
Subject: Re: [boost] Ternary logic programming
From: Rob Stewart (rob.stewart_at_[hidden])
Date: 20150705 06:10:37
On July 5, 2015 5:44:58 AM EDT, Bjorn Reese <breese_at_[hidden]> wrote:
>
> We could regard Empty as "I don't care". You may have a set of these
> variables, and you have to take action at some point even if all the
> variables have not become Value or Error so far, but you still want
> an indication if none have been set. In that case, you get:
>
> Empty && Error => Error
> Empty && Value => Value
> Empty && Empty => Empty
>
> Empty  Error => Error
> Empty  Value => Value
> Empty  Empty => Empty
That might be legitimate, and even useful, but doesn't it seem wrong that && and  yield the same results?
> Another alternative is to regard Empty as "I do care", which makes it
> behave like a NaNlike construct. This makes Empty "sticky"; if only
> one of the variables is Empty then the entire condition should be
> Empty:
>
> Empty && Error => Empty
> Empty && Value => Empty
> Empty && Empty => Empty
>
> Empty  Error => Empty
> Empty  Value => Empty
> Empty  Empty => Empty
NaN is always a source of confusion at first, so that pattern may be a source of issues, too. It doesn't help that && and  behave alike, though for different reasons than before.
> I agree that "I may care" looks fine for futures, but since Niall is
> aiming for general framework of monads, I am less convinced that this
> approach is best approach for all. It may very well be that different
> monads require different threevalued logic.
If the empty state is called the same thing in each case, different behavior will be confusing. Otherwise, I agree that forcing everything into the same pattern may be more trouble than it's worth.
___
Rob
(Sent from my portable computation engine)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk