Boost logo

Boost :

Subject: Re: [boost] [outcome] Change semantics on UB from peer review agreed semantics?
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2018-09-12 23:26:02


On Wed, Sep 12, 2018 at 3:25 PM Andrzej Krzemienski via Boost <
boost_at_[hidden]> wrote:

> czw., 13 wrz 2018 o 00:18 Peter Dimov via Boost <boost_at_[hidden]>
> napisał(a):
>
> > Andrzej Krzemienski wrote:
> >
> > > You have just described something that one could call "value or throw"
> > > idiom: `foo().value()`. It will only work under certain policies: [...]
> >
> > The basic point here is that "value or throw" or "value, period" are used
> > in
> > different ways. One is
> >
> > auto r = function().value();
> >
> > and the other is
> >
> > auto r = function();
> >
> > if( r )
> > {
> > // use the value of `r`
> > }
> >
> > Since the two forms are distinct, it doesn't really make sense to express
> > both using the same name because then you can't tell at a glance whether
> > the
> > code is correct or not.
> >
>
> Yes, they are two distinct cases. And yes, they should probably be
> expressed in two different ways.
>

My understading was that initally Outcome attempted, in part, to be an easy
solution to this problem (building interfaces which return value-or-throw
results). It appears that this functionality is now deeply burried in
policies and other complexity (assuming it still exists, which is still
unclear to me). I assume this is driven by pressure from users who don't
want to use exceptions at all.

If someone is building an API that simply needs to return value-or-throw
results, would Outcome be the recommended provider of this functionality?
Is there even a single example of such a library that uses Outcome?


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