Em Sex, 2009-03-06 às 18:51 +0100, TSa escreveu: > I know that the use of 'is also' is called monkey patching but I can't > understand why this is regarded as a bad thing. Having a class assembled > from multiple modules is a rather normal affair.
You're describing Roles here, which is something you can do. First declare the roles, than declare the class being composing with that roles. Monkey patching is a bad thing because it is "action at a distance", code that already seen the class will, without any notice, start dealing with a different behavior. Subclassing and composition are the proper way of dealing with that, that's why Perl 6 allows you to lexically replace the meaning of a name... daniel