HaloO, Daniel Ruoso wrote:
Not really... 'does' will try to compose the CGI::Simple methods to the CGI class (although I think your example was supposed to be CGI::Simple does CGI, but anyway).
Hardly. Ovid said that CGI has more functionality than CGI::Simple. So the hope for CGI.does(CGI::Simple) being true is that the common parts are compatible. The other way around CGI::Simple.does(CGI) is false because of missing functionality. The idea of deriving from a base and then disabling functionality is another classical OO fallacy.
You don't want to change the class implementation, you just want to annotate an additional 'interface' on the given implementation.
I hope that the does operator is clever enough to find out that everything needed for CGI doing CGI::Simple is already in there. So apart from noting the nominal subtype relation somewhere in the HOW or WHAT of CGI this operation is a no-op.
I'm actually not sure that you can have 'CGI does CGI::Simple', since CGI::Simple is not a role...
An intermediate, anonymous class is a mere implementation detail ;) Regards, TSa. -- "The unavoidable price of reliability is simplicity" -- C.A.R. Hoare "Simplicity does not precede complexity, but follows it." -- A.J. Perlis 1 + 2 + 3 + 4 + ... = -1/12 -- Srinivasa Ramanujan