lodash like utility/algorithms library for D
Paul Backus
snarwin at gmail.com
Sat Sep 29 19:27:29 UTC 2018
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?
More information about the Digitalmars-d-announce
mailing list