From: Peter Vanbroekhoven Date: 2005-09-11T23:50:11+09:00 Subject: Re: When an Array is not On Sun, 11 Sep 2005, David A. Black wrote: > You could also re-include Enumerable in Array after you've changed > Enumerable. Still, it does seem like some kind of optimization or > special case for built-ins. If you make your own the changes are > propagated: > > module M > def x; 1; end > end > > class D > include M > end > > D.new.x # 1 > > module M > def y; 2; end > end > > D.new.y # 2 Actually the corresponding example would be something like this: module M def y ; 'y' ; end end module N def x ; 'x' ; end end class A include N end module N include M end A.new.x # 'x' A.new.y # NoMethodError A.ancestors # [A, N, Object, Kernel] N.ancestors # [N, M] It has nothing to do with built-ins, it's a restriction of the way Ruby handles module inclusion. For more information, see the thread starting at [ruby-core:2068] http://rubyurl.com/vFI Peter