Concept
Expression problem
Books
Journey Statuslearning
Neither paradigm naturally supports both dimensions of extensibility without modifying existing code or sacrificing Type safety. Solutions exist (type classes, object algebras, tagless final) but invo
| Approach | Easy to add | Hard to add |
|---|---|---|
| ${fref("programming-language-theory/concepts/algebraic-data-type.td")}s + functions | New functions (just define another) | New variants (must edit all existing functions) |
| OO classes + methods | New variants (just add subclass) | New operations (must edit all existing classes) |
Neither paradigm naturally supports both dimensions of extensibility without modifying existing code or sacrificing type safety. Solutions exist (type classes, object algebras, tagless final) but involve trade-offs.