3 ms·
Scala also calls them enums fyi. Personally, I wish everyone would call them variant types.
by dist1ll 2y ago
Scala also calls them enums fyi. Personally, I wish everyone would call them variant types.
- saghm 2y agoI often use the term "sum types" for them, since I think it helps explain why they're useful compared to "product" types like structs or objects or tuples. I've heard people refer to them as "algebraic" types, but I don't really like that as a term for them because that feels like it should refer to sum and product types as a categorization rather than one of the categories specifically. Unfortunately, "sum type" doesn't really work super clearly in verbal conversations that often; people often tend to hear it as "some types".