Boost logo

Boost :

Subject: Re: [boost] [outcome v2] Please comment on new result<T, EC> reference API docs
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2017-06-22 00:09:46


On Wed, Jun 21, 2017 at 4:58 PM, Niall Douglas via Boost <
boost_at_[hidden]> wrote:

> On 22/06/2017 00:21, Peter Dimov via Boost wrote:
> >>>> https://dedi4.nedprod.com/static/result-v2/doc_result.html
> >
> > Niall, what does result<R, void> represent?
>
> Same as expected<R, void>.
>
> It's legal to return that failure occurred, but no information as to
> why. I see that as being possibly useful.
>
> What's far more interesting is result<void, void>. Yes expected<void,
> void> is also legal too. Where things get mind bendy is that v2
> result<T, E> can return a T with additional info E, so you can quite
> legitimately have a result<void, void> with both .has_value() and
> .has_error() returning true.
>

Wasn't this one of the issues people took with Noexcept, that since it
works with any return type whatsoever, there is no clear invariant, and you
could end up in a situation where you have a value and an error? (I
actually agree with this criticism, but in my mind this is a small price to
pay for not burdening return objects with transporting errors as well as
values.)


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