The enum type inference problem is easily solved with identifier types

Sebastiaan Koppe mail at skoppe.eu
Fri May 12 16:41:43 UTC 2023


On Friday, 12 May 2023 at 09:40:23 UTC, Richard (Rikki) Andrew 
Cattermole wrote:
> A nice side effect of this solves None value for a sumtype.
>
> ```d
> sumtype Foo = string | :None;
> ```
>
> Add a little bit of semantic to make it the default when its 
> present in set and we're good to go.
>
> I like it.

I guess you can make enums too:

```
sumtype dir = :Left | :Right;
```

:D


More information about the Digitalmars-d mailing list