Avi Bryant <avi / beta4.com> writes:

> On Wed, 10 Jan 2001, Dave Thomas wrote:
> > In the logging case, you could write a logging mixin which intercepted
> > calls to every method in classes that used it, printing their
> > parameters.
> 
> Dave - do you have an implementation in mind for this?  I've toyed with
> such things, but in fairly messy ways, like hooking into method_added to
> alias each method as it's defined, and then creating a wrapper
> method with class_eval to replace it.  If you have a cleaner way I'd
> love to see it.

In my quick hack that's exactly what I did (as well as wrapping any
existing methods). All of the real messiness was in one method.

I never got around to doing the fun stuff, such as accepting a regexp
for class and/or method names, so you can add application-wide
aspects.

I does strike me that adding aspects to Ruby requires a bit of
philosophical thinking: I started out by copying Aspect/J, and I kept
feeling that I ws missing out on some exciting Ruby possibilities.


Regards


Dave