From: Eric Mahurin Date: 2006-06-15T01:10:29+09:00 Subject: Re: Cut-based AOP On 6/14/06, Ruby Newbie wrote: > Can you provide references to better and more-established ways of offering > such > extensibility? I looked briefly at traits which you'd alluded to earlier, > but it requires changes to the core code for trait/hook insertion. I'm > interested to read about other mechanisms which are more maintainable and > extensible than AOP in Ruby if you could please share them. Here is a way to get 99% of this cut-based AOP thing (that is overengineered as Austin says): http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/295923d21d6c1842/5034dcf0262ebc1e All you need is Object#become from evil.rb. You could write a few wrappers to make this look prettier. I think if some AOP thing is added to ruby, it should be something very simple that could be extended to some elaborate AOP framework (rather than starting with an elaborate framework as trans suggested - that includes new keywords!). Here are some of the simple things that could be used as a a basis for AOP: - pre and post method hooks (what matz is planning) - Object#become/Class#replace. Can be implemented now in pure ruby (evil.rb) - something like Module#include except "super" (or something else) in the included methods refers to the previous method definition. Eric