Boost logo

Boost :

Subject: Re: [boost] [review] Review of Outcome (starts Fri-19-May)
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2017-05-19 06:33:41


2017-05-19 1:11 GMT+02:00 Niall Douglas via Boost <boost_at_[hidden]>:

> >> 2. .ensure(empty|value|error|exception) will perform the default
> actions
> >> of calling the observer function for that state, but not return that
> state.
> >>
> >
> > Weak yes. - I am not sure why you need this fancy syntax.
>
> The constexpr variables are already there. So basically do we prefer:
>
> 1. .ensure_empty(), .ensure_value(), .ensure_error() and
> .ensure_exception()
>
> 2. Or .ensure(empty), .ensure(value), .ensure(error) and .ensure(exception)
>
> I figure the latter looked nicer. It's same difference to the compiler,
> simple overload matching is constant time.
>

At the end of the day it is just syntax, so your choice is a as good as any
other. But if you use those "constants", one might ask why are you not
using them consistently. You could also get rid of `value()`, `error()`,
`exception()` and instead provide `get(value)`, `get(error)`,
`get(exception)`. I am not proposing it, though.

Just one note. If I use namspace prefixes, the notation with "constants"
becomes longer:

`o.ensure_empty()` becomes `o.ensure(boost::outcome::empty)`

One could respond to this "just import anything from namespace
`boost::outcome` into the scope", but that is imposing on me a certain
style of programming, which I not necessarily want to adapt.

Regards,
&rzej;


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