Boost logo

Boost :

Subject: Re: [boost] [outcome] Andrzej's review
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2018-01-27 12:00:49


2018-01-27 2:54 GMT+01:00 Niall Douglas via Boost <boost_at_[hidden]>:

> > For instance, you can say "default-constructed error_code is
> > considered an error, and treated as such by the library", or "the
> > library sometimes may make use of the fact that a
> > default-constructed EC/EP is not an error, so make sure not to pass
> > us such values": I am fine with any answer, but I need you to spell
> > it out, so that I know what to expect.
>
> Can you show me the exact page where I say the second sentence? Maybe
> it's because it's 1:50 am and I'm too tired after a 6am start, but I
> cannot find that sentence in the documentation.
>

You do not say it in the docs. But one could get that impression. E.g. from
the previous versions, where function .error() default-constructed EC if it
was absent, and it was recommended to use .error() to check both existence
of error and its value.
Also, I got confused with the consequences of this bug:

```
#include "outcome.hpp"
namespace out = OUTCOME_V2_NAMESPACE;

int main()
{
  out::outcome<int> o {std::error_code{}};
  assert (o.has_error());
  out::outcome<int> p = o.as_failure();
  assert (!p.has_error());
}
```

Somewhere in the interaction between outcome and failure_type there is a
bug that treats default-constructed EC as no EC. And now I wonder: is it a
bug, or is it my fault that I used default-constructed code.

> > 3. Similarly, I request that you put in the docs what is the "value"
> > of an object of type `outcome<>` or `result<>` in the sense in which
> > John Lakos talks about "salient attributes". I know that T, EC, and
> > EP constitute the value. But in the middle of the tutorial we learn
> > that apart from these you also store "spare_storage" -- is it also
> > included in copying and comparisons?
>
> Yes in copying where copying is not explicitly done (i.e. type
> conversion is performed).
>
> No in comparisons.
>
> I will add this to the documentation. Tracked at
> https://github.com/ned14/outcome/issues/117
>
> > Also, what does it mean that result is equal to
> > optional. Define it somewhere and paste links to it.
>
> Do you mean `optional<T>` being equal to `result<T, void>` or something?
>
> Or do you mean via the `ValueOrNone` concept, or something else entirely?
>

Sorry, I am recovering from flu, and sometimes some bug sneaks in. I meant
comparing an `outcome<>` with a `result<>`. What are the semantics then?

Regards,
&rzej;


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