sumtype 0.5.0

Paul Backus snarwin at gmail.com
Thu Aug 9 15:41:03 UTC 2018


On Thursday, 9 August 2018 at 07:52:12 UTC, vit wrote:
> SumType without initialization doesn't fail if first type has 
> @disabled this().

It did fail for me, but it also failed *with* initialization too, 
so there was definitely a bug there.

> method toString is not template. (why is there in the first 
> place?)

Mainly it's there so I can do `writeln(sumTypeInst);` without 
writing out the full `match` call every time. I can't see any 
reason why it should be a template.

> SumType can have zero TypeArgs but then tryMatch fail:
>
> [...]
>
> struct SumType(TypeArgs...)
> if(TypeArgs.length > 0){
> }

The second option is what `Algebraic` does, and it seems like the 
most sensible solution to me.


More information about the Digitalmars-d-announce mailing list