|
Boost : |
Subject: [boost] Ternary logic programming (was: Re: [variant] Maintainer)
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-07-01 20:49:54
On 1 Jul 2015 at 15:53, charleyb123 . wrote:
> Under an alternative model, the common construct would be something like:
>
> void foo(...) {
> return switch_(...) {
> ...
> }
> }
>
> ... and you manage your true/false/unknown cases explicitly. Works great
> for asynchronous and distributed, and for interfacing-with-hardware.
That's exactly what Rust does. In fact, you'll find yourself either
writing match x { patterns ... } or using monadic programming. A lot,
because there is little other choice.
Out of interest, what do you think of my free function ternary logic
programming:
tribool t;
if(true_(t)) { /* true */ }
else if(false_(t)) { /* false */ }
else if(unknown(t)) { /* other state */ }
Nobody here seemed to like it. I am looking for something the average
programmer will notice immediately and not accidentally assume it's
boolen logic going on here.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk