2 ms·
> Why would it be difficult to retrofit? It’s just a new set of types. Is it that existing APIs wouldn’t be using them? It's a brand new kind which wouldn't ne
by masklinn 5y ago
> Why would it be difficult to retrofit? It’s just a new set of types. Is it that existing APIs wouldn’t be using them?
It's a brand new kind which wouldn't necessarily work the way existing types do, and it's a whole lot of extra syntax.
Plus previous retrofits have not exactly panned out great, C++ and Java's native "type safe enumerations" are pretty crummy as they're closer to enumerated sets of constants than sum types.
Sealed classes/interfaces/traits/… fit well in the machinery and aesthetics of RTTI-heavy products-types-based languages and slot nicely into the "niche" of sum types.