A proposal: Sumtypes

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Sat Feb 17 09:46:13 UTC 2024


On 09/02/2024 7:10 AM, ryuukk_ wrote:
> I personally not a fan of having a new keyword, it's words i can no 
> longer use in my code, we have `union` and `enum` a sumtype is the 
> combination of both, so why not:

I suspect we'll be using ``sumtype`` for this regardless.

But at least it isn't as bad as Haskell with the ``data`` keyword to 
designate more or less a sumtype.

> I am not a fan of using `.match` and not a fun of having `match` wich is 
> yet another new keyword, why not reuse `switch`?

I am not proposing the match capability, first let's wait and see what 
Walter proposes in his DConf Online 2024 presentation. If it is a good 
design that hits the marks then a competing design isn't required to be 
attempted ;)



More information about the Digitalmars-d mailing list