On Fri, 2004-04-30 at 16:59, Stéphane Payrard wrote: > Perl6 seems already to have plenty of mechanisms like delegation > to dynamically change the behavior of a class. So, probably, > wrappers is a mechanism more adapted to extend method behavior at > run-time by entities that don't have access to the internals of a > class. > > Comments?
that's all true. I just wanted to "stress" the mechanism to understand the various implications. and wrappers seem a good tool, anyway, to implement something similar to Aspect Oriented Programming. but Aspects need to be modular units, like classes or roles, so I wanted to explore the possible interoperability of wrappers and classes. another example I can think of: role Logging { POST { foreach ( ::_.meta.getmethods() ) -> $method { $method.wrap( { log($somewhere, "calling $method"); call; log($somewhere, "called $method"); } ); } } class Foo does Logging { ... } does something like this make sense? cheers, Aldo