std.sumtype?
surlymoor
surlymoor at cock.li
Sun Aug 29 21:48:47 UTC 2021
On Sunday, 29 August 2021 at 19:51:30 UTC, Paul Backus wrote:
> ```d
> return exp[0].match!(
> (IdentifierExpression exp) => exp.ident,
> function string (_) { throw new Exception("..."); }
> );
> ```
>
> Note the explicit return type of `string` on the second lambda.
> The compiler will allow this, even though the lambda never
> returns a `string`, because it never returns normally at all.
Can't wait until DIP1034 is fully implemented so one needn't do
this.
More information about the Digitalmars-d
mailing list