4 ms·
> You can't have closed enums without value constraints Sum types and closed enums don't need to constrain existing sets of values, they define the set of valu
by grumpyprole 3y ago
> You can't have closed enums without value constraints
Sum types and closed enums don't need to constrain existing sets of values, they define the set of values. Again, I think you might be confusing the type system with runtime representation.
> It's a neat parlour trick, don't get me wrong,
It's a step towards sum types which are the mathematical dual of product types. Not a parlour trick at all, every modern language should have algebraic data types.