4 ms·
I think it's usually refered as "the expression problem". Here's a good post about it: https://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutio
by Zababa 5y ago
I think it's usually refered as "the expression problem". Here's a good post about it: https://eli.thegreenplace.net/2016/the-expression-problem-and-its-solutions/ https://eli.thegreenplace.net/2016/the-expression-problem-an.... The idea is that when you have existing data and operations on them, how can you add more data and more operations without controlling the original code.
There's also a part about early and late binding. In statically typed FP programming, the compiler will warn you where you forgot enum cases when you add one. This is because this information is known at compile time. If you want to generate classes at runtime while keeping the same code, you may prefer the late-binding approach of having the class itself handle how it reacts to an operation.