From: Eric Mahurin Date: 2005-10-20T23:00:43+09:00 Subject: Re: [ANN] [RCR] Cut-based AOP --- Yukihiro Matsumoto wrote: > Hi, > > In message "Re: [ANN] [RCR] Cut-based AOP" > on Wed, 19 Oct 2005 08:56:59 +0900, "Trans" > writes: > > |This is to "officially" announce an RCR that I posted to RCR > archive > |two days ago. I realize the RCR itself is a bit dense and > techincial, > |so (with thanks to ES) I thought it might be a good idea to > provide a > |little summary and some examples of what it's all about and > why it's a > |such a good approach to AOP for Ruby. > > I understand the basic idea. How about introducing a new > method > e.g. "preclude" that works to intercept the methods in the > target > class/module, instead of cut. It would be a counterpart of > "include" > for mix-in. > > matz. +1, if it is what I think you mean. Is this what you mean? class C def foo "bar" end end c = C.new c.foo # => "bar" module Braces def foo "{"+super+"}" end end class C preclude Braces end c.foo # => "{bar}" module Brackets def foo "["+super+"]" end end class C preclude Brackets end c.foo # => "[{bar}]" module Braces remove_method :foo end c.foo # => "[bar]" I really like this. I don't see anything you couldn't do with this that you can with the cut-based-AOP. And it seems so much simpler. __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com