Subject: Re: [boost] expected/result/etc
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2016-02-13 00:53:39
On 2/12/2016 11:36 PM, Emil Dotchevski wrote:
> Let's say in your example, the function throws 50% of the times you call
> it. Assuming this isn't an anomaly, it means that you're not really
> throwing to indicate a failure, but to report a result. Obviously that's
> not a good design.
And this is exactly the sort of situation I would want to use result<T>
in instead of throwing an exception.
I want discriminated union type that is optimized in interface and
implementation specifically for transporting a T or an error code.
And, if in the design a choice must be made, favors T slightly.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk