From: Gavin Sinclair Date: 2004-09-14T10:15:23+09:00 Subject: Re: traits & roles Phil wrote: >> module Foo1 >> def foo; "foo1"; end >> end >> >> module Foo2 >> def foo; "foo2"; end >> end >> >> class X >> end >> >> x = X.new >> >> x.foo # error >> >> x.extend Foo1 >> x.foo # "foo1" >> >> x.extend Foo2 >> x.foo # "foo2" >> >> x.unextend Foo2 >> x.foo # "foo1" >> > > Yes, you're right. This would be better behavior. Any idea how > something like that could be implemented? Yep: in the Ruby core! :) Only pure-Ruby solution I can think of is to remember the modules that have been mixed in, and selectively reapply earlier ones when 'unextend' is called. Pretty fugly. Gavin