4 ms·
> Thus, even Java has product types. Even C has product types. Which is why I'm always bothered when people claim language X lacks algebraic data types. They
by masklinn 9y ago
> Thus, even Java has product types.
Even C has product types. Which is why I'm always bothered when people claim language X lacks algebraic data types.
They probably lack sum types, but are very unlikely to lack product types.
- beojan 9y agoC also has sum types with unions (though without any indication of which of the alternatives is actually present).
- red75prime 9y agoThey are mix types then.
- kod 9y agoProduct types without sum types and pattern matching are basically useless for expressing ADTs. That's what people mean.
- masklinn 9y ago> Product types without sum types and pattern matching are basically useless for expressing ADTs. That makes no sense. Algebraic data types are not expressed, they're a concrete thing, a classification of composite types (by multiplication (hence product types) or addition (hence sum types)).
- kod 9y agoSure it does, languages allow you to express things. Some shitty languages don't have a concise way for you to express particular things (like sum types), so you have to rely on idioms or "patterns".