|
Boost : |
Subject: Re: [boost] [review] Outcome Review Report
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2017-06-06 15:15:33
> Since conclusion of the review period, discussion continues (on and
> off-list) regarding possible evolution to the Outcome library, related to
> feedback provided during this review, and related to discussions of design
> evolution for pertinent libraries (e.g., possible changes to
> std::expected<>, and evolution of a never-empty âvariant2<>â). It is
> promising that such a strong library as Outcome continues to receive
> critical attention and evolution by multiple interested parties.
Thank you so much Charley for review managing one of the lengthiest and
most complex reviews we have had here at Boost in some year.
I like to take a month's break from all programming after a review has
ended, as it happens I have lots of non-programming stuff backlogged
anyway, so it's good timing. But for those not following the continuing
discussions, the rough plan moving forward is this:
1. Expected implementation to be no longer implemented by Outcome, maybe
by Peter Dimov's Variant2 library at some future point instead.
2. Outcome to drop the variant based storage. Outcome gets simplified
into this synopsis (design still evolving, this is a snapshot of current
thinking):
```
template<
class T,
class EC = error_code_extended
> class result
{
T _value;
EC _error; // 24 bytes
public:
// Constructors to be inspired by std::variant's
// Narrow observers
T &access_value() noexcept;
EC &access_error() noexcept;
// Wide observers
T &value();
EC &error();
};
template<
class T,
class P = shared_ptr<void>,
class EC = error_code_extended,
class E = exception_ptr
>
class outcome
: private result<T, EC>
{
using base = result<T, EC>;
union
{
P _payload; // 16 bytes
E _exception; // 8 bytes
};
public:
// Constructors to be inspired by std::variant's
// Explicit construction from compatible result<_T, _EC>
template<class _T, class _EC> explicit outcome(result<_T, _EC>);
// Narrow observers
using base::access_value;
using base::access_error;
P &access_payload() noexcept;
E &access_exception() noexcept;
// Wide observers
using base::value;
using base::error;
P payload();
E exception();
// Returns exception state, but if errored, synthesises
// an exception_ptr of the error code
E failure();
};
static_assert(sizeof(outcome<void>) == 40); // bytes overhead
```
I've left out some detail, but the above gives the idea.
> Great thanks to the Boost Community for their tremendous efforts,
> disciplined review, and detailed exploration of topics in considering this
> library submission.
>
> Sincerest appreciation to Niall Douglas (Author of the Outcome Library) for
> pushing the envelope for low-latency <error|exception> handling and for
> submitting his work to the Boost Review process.
Thank you to the Boost community so much for helping me with the design
of this library. It helps a great deal to return to the drawing board
armed with so much high quality feedback.
Niall
-- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk