From: Christoph Date: 2002-04-04T23:11:54+09:00 Subject: Re: Mixins vs. Multiple Inheritance "Jason Voegele" wrote in .... > So how would the following scenario be any different if Foo and Bar were > classes instead of modules? (presuming that Ruby had true multiple > inheritance): I find it interesting that Ruby's (1.7) default method-search order in ``Mixin''-Graphs coincides with (or is at least ``close to'') the Python 2.2 method-search order in a ``MI''-Graph. However with a bit of work one can also create a ``Mixin''-Graph with a C++-like method look up - i.e. Ruby's mixin strategy is in some sense more complex than ``ordinary'' purely class based MI. /Christoph ----- # the output of the classical diamond-graph (why isn't this # called rhombus?) script assuming (1.7) is # D < L < R < O is python's method-search order # D < L < O < R is the c++'s method-search order module O end module L include O end module R include O end module D include R include L end puts "#{D.ancestors.join(' < ')} is python's method-search order" class Object; remove_const :O remove_const :L remove_const :R remove_const :D end module O end module L end module R end module D include R include O include L end module L include O end module R include O end puts "#{D.ancestors.join(' < ')} is the c++'s method-search order" ----