hello!

im currently working on a aop library for ruby. most of the things like 
pointcuts and
joinpoints work fairly well. unfortunately i can not find a elegant 
solution for something:

- it must be possible to pass objects which have aspects weaved around 
without
running into a deadlock, this is especially important for passing them 
to advices.

- advices must be also working when methods of the object are called by 
the
object itself.

basically i see two possibilities:

1) via a proxy, which holds the original object, creates each method 
existing on
the original object for the proxy. something like:

def foo
	SomeAspect.before...
	@object.foo
end
(totally oversimplified, i know =)


2) via rewriting the methods on the object itself. weaving in the 
advices
directly and just calling the original method via the id..

the problem is that neither of those possibilities solve both problems.
the first one makes it impossible that advices are applied when methods
are called from within the object itself, since the method is not 
called via
the proxy.. (is it possible to do something nasty like redefining 
'self' for
a object? =)

the second one can lead to quite serious trouble, because there is no 
way
to guarantee that the method is called without any advices (for example 
by
advices themself)

is there any other possibility to solve this in ruby? amy i overseeing 
something?

thanks a lot for any tipp!

ciao!
florian