3 ms·
What does inheritance give you that pattern matching doesn't? Edit: Also, what raganwald says.
by silentbicycle 16y ago
What does inheritance give you that pattern matching doesn't?
Edit: Also, what raganwald says.
- jpr 16y agoExtensibility of the type without breaking existing code. When you add or remove a case from an algebraic data type, you pretty much need to modify all functions that operate on it since they contain patterns that mention the data-constructors that you either removed, or they don't cover all the cases anymore. (if you meant pattern matching as in text/regular expressions, disregard what I just wrote)