-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Bjorn Reese Sent: Tuesday, June 25, 2013 12:10 PM To: boost@lists.boost.org 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
adopt different conventions, which means that you cannot know if is_left() checks for the value or
project will 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@hetp.u-net.com