According to Pickaxe, Ch. 19, pg. 245, under Mixin Modules:

  "When you include a module, Ruby creates an anonymous proxy class that 
references that module, ... This is important: the same module may be 
included in many different classes, and will appear in many different 
inheritance chains. However, thanks to the proxy class, there is still only 
one underlying module: change a method definition in that module, and it will 
change in all classes that include that module, both past and future."

Yet, I seem to a have found an explict case where this does not occur.

  module W
    def x; print "W"; super if defined?(super); end
  end

  module A
    def x; print "A"; super if defined?(super); end
  end

  class C
    def x; print "C"; super if defined?(super); end
  end

  c1 = C.new
  class << c1; include W; end

  print "1. WC == "; c1.x; puts

  module W
    include A
  end

  print "2. WAC == "; c1.x; puts

  c2 = C.new
  class << c2; include W; end

  print "3. WAC == "; c2.x; puts

This produces:

  1. WC == WC
  2. WAC == WC
  3. WAC == WAC

Number #2 should produce WAC, given the dynamic behavior of Ruby, and just as 
the PickAxe describes, there is but one Module W. So how is it that c1 does 
NOT RESPOND to the inclusion of A, although the new c2 does?

Thanks,
T.


-- 
T.