From: alxtskrnk@... Date: 2018-01-16T17:34:52+00:00 Subject: [ruby-core:84895] [Ruby trunk Bug#14365] irreconcilable ancestor chain ordering expectations should perhaps produce an error Issue #14365 has been reported by bughit (bug hit). ---------------------------------------- Bug #14365: irreconcilable ancestor chain ordering expectations should perhaps produce an error https://bugs.ruby-lang.org/issues/14365 * Author: bughit (bug hit) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- ```ruby module Module1 def foo puts 'Module1#foo' super end end module Module2 include Module1 def foo puts 'Module2#foo' super end end class SuperClass1 def foo puts "SuperClass1#foo" end end class SubClass1 < SuperClass1 include Module2 include Module1 def foo puts "SubClass1#foo" super end end p SubClass1.ancestors SubClass1.new.foo ``` If you look at SubClass1 in isolation, the expectation is that Module1 will be in front of Module2 If you look at Module2 in isolation, the expectation is that Module2 will be in front of Module1 these can not be reconciled, Module2 wins, but would it not be better if this were an error? Forcing you to write: ```ruby class SubClass1 < SuperClass1 include Module1 include Module2 def foo puts "SubClass1#foo" super end end -- https://bugs.ruby-lang.org/ Unsubscribe: