Boost logo

Boost :

Subject: [boost] [outcome] Ternary logic -- need an example
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-05-15 12:38:56


Niall Douglas wrote:

> Finally, if you did have some special E value to mean empty, you would
> have to write special checks for it in Outcome in order to give it the
> stronger abort type semantics it has - if you don't have it being given
> alternative semantics, then there is no point in having an empty state.
> If you are writing special checks, then you might as well just have a
> formal empty state in the first place.
>
> This argument can be generalised into the argument in favour of ternary
> logics over binary logics. Sure, 90% of the time binary logics are
> sufficient, but binary is a subset of ternary. And *you don't have to
> use* the "other" state in a ternary logic just because it's there. Just
> don't use it, so long as its implementation signals its unintentional
> usage with a very loud bang, it's a safe design.
>
> (There is an argument that Outcome's "very loud bang" isn't loud enough.
> I'd be pleased to hear feedback on that)

Niall, you mention "ternary logic" here, and I guess it has to do with
'module' `tribool` exposed by Outcome library. But I do not believe I have
seen in the documentation (I mean the tutorial section) how I am supposed
to use it, and how it improves my programs. Or I might have just missed it.
Could you give me an example?

Regards,
&rzej;


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