3 ms·
The concept of of a sum type is simple. It's just the type-theoretic notion of logical disjunction, how a particular language expresses that is sort of high-lev
by noblethrasher 14y ago
The concept of of a sum type is simple. It's just the type-theoretic notion of logical disjunction, how a particular language expresses that is sort of high-level implementation detail.
Java and its ilk do have sum types: they're called abstract classes; the derived types are the variants.
In C# (and probably Java) you can easily define both open and closed sum types simply by marking the base class constructor as either `public` or `protected`.