From: matz@... (Yukihiro Matsumoto) Date: 2001-06-08T15:05:12+09:00 Subject: [ruby-talk:16322] Re: require and include confusion Hi, Sorry for being late. I missed this one somehow. In message "[ruby-talk:16074] Re: require and include confusion" on 01/05/31, Mathieu Bouchard writes: |But I have just found a case where it actually matters. Here it is: | |module A; end |module B; include A; end |module C; include A; end |[A,B,C].each{|k| k.module_eval "def foo; '#{k}' + super; end" } |module Kernel; def foo; "" end end |x = Object.new; x.extend C; p x.foo |include B; p x.foo |x = Object.new; x.extend C; p x.foo | |This prints: | "CA" | "CABA" # A is seen twice in old x | "CBA" # A is seen once in new x Well, module duplication check is done when "include" is done. So that if insertion to upper level (Object this case) is done AFTER any insertion, it would be remain doubled. I don't think I can rescue this case. matz.