On Saturday, 29 September 2018 at 12:40:14 UTC, aliak wrote:
I.e. by allowing you to define the unexepcted you could for instance:

enum JSONError {
  invalidKey, notString, notNumber
}

auto a = parse(jsonData);

a.getAsString("key").match!(
    (string value) => // yay
    (JSONError error) => // small domain of what went wrong
);

I agree that this is useful, but why not just return a naked `SumType!(string, JSONError)` in that case? Is there some additional value added by the `Expect` wrapper that I'm not seeing?


Reply via email to