|
From: Joachim Durchholz on 11 Nov 2007 18:03 Marshall schrieb: > Very interesting. Can you expand on the difficulties that multiple > dispatch brings to the question of composable modules? Assume you have a multi-dispatching function f (A, B) Now the author of class A creates a subclass A', and the associated function f (A', B) Likewise for the author of B: f (A, B') Problems arise if the two authors don't know about each other (or can't or don't want to collaborate). Then, combining classes A' and B' in one system will lack a definition for f (A', B') There are several ways to deal with the situation: 1) Give priority to one of the parameters (usually the first one). This means f (A', B') defaults to f (A', B). This can cause problems if the implementations of A' and B' are so different from their respective base classes that f (A', B') really would have to be written. 2) Force the integrator to write f (A', B'). Extra bonus if he doesn't have the sources of A' and B'. The "nonmodular" bit comes from the observation that A' and B' aren't modules anymore: they cannot be added independently, there's an interaction between them. Regards, Jo
|
Pages: 1 Prev: MVC in "Head First Design Patterns" - I am confused. Next: Can you suggest a project? |