From: "mame (Yusuke Endoh)" Date: 2012-07-23T22:37:02+09:00 Subject: [ruby-core:46652] [ruby-trunk - Feature #1586] Including a module already present in ancestors should not be ignored Issue #1586 has been updated by mame (Yusuke Endoh). Assignee changed from matz (Yukihiro Matsumoto) to ko1 (Koichi Sasada) Jeremy Kemper and Clay Trump, This proposal was discussed as two separate ones: 1. allow multiple inclusion 2. propagate when a module includes a module Both have been (basically) accepted. Congrats! For part (1), matz said that he had tried to implemented this feature for 1.9.0, but had given up due to a bug of YARV (#3351). Ko1 will challenge to fix the bug. For part (2), the behavior was designed because matz had no idea to implement it effectively. However, after the discussion, we concluded it was possible to implement the feature effectively. Then, matz said he was happy to change the current behavior as a "bug". Ko1 will challange to implement it. Note that these decisions may be cancelled if ko1 finds any (practical or technical) significant problem. -- Yusuke Endoh ---------------------------------------- Feature #1586: Including a module already present in ancestors should not be ignored https://bugs.ruby-lang.org/issues/1586#change-28315 Author: bitsweat (Jeremy Kemper) Status: Assigned Priority: Normal Assignee: ko1 (Koichi Sasada) Category: core Target version: 2.0.0 =begin The scenario: * I include Foo in Numeric to provide #bar * Some other library includes a module in Float to provide #bar * So I include Foo in Float to use my #bar * But including Foo in Float is ignored since it's already in the ancestor chain I think it should be added to the ancestor chain, even if it's already present, since I may want to override some other method earlier in the ancestor chain. # Including a module already included in a superclass is ignored >> module Foo; end => nil >> class Numeric; include Foo; end => Numeric >> Float.ancestors => [Float, Precision, Numeric, Foo, Comparable, Object, Kernel] >> class Float; include Foo; end => Float >> Float.ancestors => [Float, Precision, Numeric, Foo, Comparable, Object, Kernel] # Reversing the order of inclusion works as expected >> module Foo; end => nil >> class Float; include Foo; end => Float >> Float.ancestors => [Float, Foo, Precision, Numeric, Comparable, Object, Kernel] >> class Numeric; include Foo; end => Numeric >> Float.ancestors => [Float, Foo, Precision, Numeric, Foo, Comparable, Object, Kernel] # And so does including a dupe of the existing module in the subclass >> module Foo; end => nil >> class Numeric; include Foo; end => Numeric >> Float.ancestors => [Float, Precision, Numeric, Foo, Comparable, Object, Kernel] >> class Float; include Foo.dup; end => Float >> Float.ancestors => [Float, #, Precision, Numeric, Foo, Comparable, Object, Kernel] =end -- http://bugs.ruby-lang.org/