From: Jim Weirich Date: 2008-10-08T00:00:50+09:00 Subject: [ruby-core:19170] Re: [Feature #615] "with" operator On Oct 7, 2008, at 10:23 AM, _why wrote: >> The second conversation is about temporarily adding methods to the >> current >> object in order to get DSL-like capabilities. This was thread was >> introduced by the suggestion of using the mixin/unmixin techniques. > > I really think this is a good idea for a `with` method, though. > Rather than altering `self`, we could temporarily re-route methods. > I'm saying that we take mixins a step further: beyond modules and on > to objects, any object at all. But if I understand the implementation, you are not intercepting the messages. They still go to the original object. All you've done is redefine the messages. How do you plan to redirect them to the object given in the 'with' statement? BTW, I totally agree with taking mixins to the object level. If that were done, a lot of my concern over thread-safety would be alleviated (since you are only modifying the methods for a single object rather than the methods for *all* the objects of that class. -- -- Jim Weirich -- jim.weirich@gmail.com