sumtypes for D

Timon Gehr timon.gehr at gmx.ch
Tue Nov 29 14:40:20 UTC 2022


On 11/29/22 14:30, deadalnix wrote:
> 
> Yes, and what I'm telling you is that the problems who'd deserve to be 
> solved here are not specific to sum types, at least, not the worse 
> offenders.

I am also in favor of making solutions that are needed for sum types 
available to user-defined types to a good extent. But I do think some 
new solutions are needed, also on the front of the grammar.

> Therefore, baking a special case solution for sum type would:
> 1/ Not solve the core issue to begin with.

Together with tuples, it solves the issue that there are no algebraic 
data types. I think this is significant and no pure library solution can 
match the ergonomics of a well-designed built-in solution.

> 2/ Make the core issue harder to solve, because it now has to be 
> compatible with whatever is done for sum types.

Ideally that's not a constraint because it will be done right for sum 
types first and can then inform a more general solution.

> 3/ Increase language complexity, which means more bugs and other problem 
> in practice.
> 4/ Tooling problems.

Fair points.


More information about the Digitalmars-d mailing list