|
Boost : |
Subject: Re: [boost] expected/result/etc
From: Robert Ramey (ramey_at_[hidden])
Date: 2016-01-27 11:32:41
On 1/25/16 10:16 PM, Michael Marcin wrote:
> Some months ago there was a lot of discussion regarding Rust style
> return values for non-exceptional error handling.
>
> Did anything ever come of this?
> Is there a useable library?
>
> Apologies if I missed an announcement (I've been away for a bit).
I confronted and addressed this problem in the Safe Numerics library.
The data type is called "checked_result<R>". Although it was intended to
be internal to the library, I did document and test it independently.
One thing that turned out to be necessary in my application was that it
be constexpr.
I'm not entirely convinced that a general solution is desirable or even
possible. It's a simple data type. But once you start using it you run
into application specific issues such as should it be convertible,
constexpr, etc., ... . On the other hand, if it is worthwhile, to
standardize/libraryize/ etc it's going to entail a huge amount of bike
sheding - as we've already had a taste of.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk