Second draft: Sum Type by Struct

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Sep 15 15:57:08 UTC 2026


On 07/09/2026 5:08 AM, MaxB wrote:
> __sumtype Status = Ok | Error | Warning;
> 
> -----
> 
> Do they need to be defined elsewhere?
> 
> Maybe:
> 
> struct Ok {}
> struct Error {}
> struct Warning {}

Exactly.

I really wish we had identifier types than you could do:

```d
__sumtype Status = :Ok | :Error | :Warning;
```



More information about the dip.development mailing list