|
Boost : |
Subject: Re: [boost] [outcome] High level summary of review feedback accepted so far
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-05-29 23:41:29
On 30/05/2017 11:25, Vicente J. Botet Escriba wrote:
> Le 29/05/2017 à 17:05, Niall Douglas a écrit :
>>>> - error_type& .error_raw() - reinterpret_cast<error_type&>
>>> evidently we don't like the _raw suffix.
>> .error_unsafe(), .unsafe_error(), .unchecked_error() all work for me too.
> How likes any of those?
> Who prefers error() to throw if there is a value? or return by value and
> return E{} when there is a value and I don't know hat when there is an
> exception_ptr?
FWIW, my preferred options would be (which I think were the originals):
- value() throws if holding error or exception (or empty)
- error() returns E{} if holding value or E{errc::has_exception} if
holding exception, or E{errc::no_value} if empty (names made up on the
spot, doesn't matter)
- exception() returns nullptr if holding value or error or empty
These seem like safe and reasonable defaults and permits code to always
extract an error_code or exception_ptr even on success, which can aid
certain interop scenarios with older APIs and otherwise simplify caller
logic.
I would prefer that unchecked_* (or whatever) versions did not exist as
then nobody would accidentally call them and perhaps introduce UB. But
I'm not strongly opposed to them.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk