Subject: Re: [boost] Interest in an 'either' library?
From: Bjorn Reese (breese_at_[hidden])
Date: 2013-06-25 07:10:19
On 06/24/2013 08:53 PM, Pierre Talbot wrote:
> I honestly think that if Either goes into Boost, we shouldn't consider
> it as a value or error structure at all. Expected (will) do the job.
I completely agree. While I have nothing against Either, I would not
want to use it for error handling for various reasons.
Apart from the function chaining that you have described, there are
also traits that allows you to customize certain aspects for your own
There are implicit conversion of values, so the code for the normal
case look more clean.
With Either you always have to specify the error type, whereas with
Expected it can be omitted.
With Either you have to adopt a convention about which side is the
error code. And different project will adopt different conventions,
which means that you cannot know if is_left() checks for the value or
the error without looking up the type.
In short, I believe that Expected offers a better usability for
(non-Haskell) programmers than Either does in the error use case.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk