3 ms·
This is called the Expression Problem (http://en.wikipedia.org/wiki/Expression_Problem http://en.wikipedia.org/wiki/Expression_Problem). Once you have a program
by chriseidhof 16y ago
This is called the Expression Problem (http://en.wikipedia.org/wiki/Expression_Problem http://en.wikipedia.org/wiki/Expression_Problem). Once you have a program, you want to be able to extend it in multiple ways: adding new classes or adding new methods to every class. In Haskell this is sometimes solved using attribute grammars. They are very similar to aspect-oriented programming, which is another way to solve the problem.
I have seen both AG's and AOP used. Sometimes it is a very elegant solution (for example, when writing a compiler), but it can also quickly lead to messy code.
- lisper 16y ago> adding new classes or adding new methods to every class Common Lisp lets you do both. These are not problems with polymorphism, these are problems with brain-damaged implementations of polymorphism.