Boost logo

Boost :

Subject: Re: [boost] Ternary logic programming (was: Re: [variant] Maintainer)
From: Steve M. Robbins (steve_at_[hidden])
Date: 2015-07-02 09:31:07


On July 2, 2015 11:16:31 AM Niall Douglas wrote:

> > In your monad application, I have never seen operators || or && mentioned,
> > so there seems to be no reason to adapt names "true" and "false" for the
> > three states. You might as well call them "A", "B" or "C", or to more
> > closely reflect your application: "value", "failure", "internal_error".
> >
> > Am I missing something?
>
> Hopefully I explained it in my reply to Charley.

I didn't see this question addressed.

 
> There are also accessor member functions on monad, so
> empty()/has_value()/has_error()/has_exception().

So that should be enough, then? You could write the logic in clear terms:

        if (monad.has_value()) { .. }
         else if (monad.has_error()) { ... }
        ...

Why even bring up "tribool" at all in this context? It seems like an
invitation for people to make buggy / unclear code.

-Steve




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk