Skip to content
scrambled
Programming Language Theory Concept

Expression problem

Books JourneyProgramming Language Theory 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
Algebraic data types + 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.