On Wed, Oct 08, 2008 at 12:00:50AM +0900, Jim Weirich wrote:
> 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?

Okay, yeah, the extension isn't actually there yet.  The extension
merely proves that unmixing works atomically and efficiently
(without resorting to crufty add_method and remove_method hacks.)

The next step is to wrap an object in a T_ICLASS and see if that can
be used to redirect methods to an object, just as with a module.

> 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.

Wonderful, yeah, I think object mixins show some promise.  Who knows
if they'll be applicable to Builder, but I think they could be a
nice middle-ground between instance_eval and normal blocks.

During the `with` or `mix_eval`, you'd have:

  self => #<Builder> => Superclass => Kernel => Object

And the class that `self` belongs to would remain intact:

  Class => Superclass => Kernel => Object

_why