Boost logo

Boost :

Subject: Re: [boost] Interest in an 'either' library?
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2013-06-25 07:31:49


> -----Original Message-----
> From: Boost [mailto:boost-bounces_at_[hidden]] On Behalf Of Bjorn Reese
> Sent: Tuesday, June 25, 2013 12:10 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] Interest in an 'either' library?
>
> 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 error type.
>
> 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.

+1

This is what ordinary users (who are the main customers for this) will want.

Paul

---
Paul A. Bristow,
Prizet Farmhouse, Kendal LA8 8AB  UK
+44 1539 561830  07714330204
pbristow_at_[hidden]

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