Agilefreaks / Aquarium

An AOP library for Ruby
https://rubygems.org/gems/aquarium/
149 stars 24 forks source link

[RubyForge-14054] Allow join points in an aspect to be "re-evaluated" #19

Open hedgehog opened 14 years ago

hedgehog commented 14 years ago

Date:2007-09-18 18:24 Priority:2 Submitted By:Dean Wampler (deanwampler) Assigned To:Dean Wampler (deanwampler) Category:Advice handling State:Open Summary:Allow join points in an aspect to be "re-evaluated"

Detailed description

When an aspect is created, it finds the matching join points based on the state of the runtime at that moment. Types or objects are that are loaded or created later, which might also match, won't be advised.

This FR is to add the capability to have an aspect check again for possible join points. The behavior should be as follows:

Note, the last point may never happen, as a reference to the join point in the aspect might keep it alive, even if all other references are gone. It would be nice to find a way to detect such a situation or use the equivalent of Java "weak references" so that aspect's reference to the object is ignored when the garbage collector is used.

A more sophisticated implementation of this feature (and one that is probably preferred) would be to observe the runtime for newly-loaded classes and newly-created objects and apply advise dynamically.

hedgehog commented 14 years ago

I know the FFI library/gem wrestled with garbage collection and Ruby Object's lifespans, etc. Something might be learned from their experinces? http://github.com/ffi/ffi