From: "Aleksi Niemelä" Date: 2000-07-05T16:48:46+02:00 Subject: [ruby-talk:03831] Re: Order of overwriting > Well, I'm probably wrong, but the declarations overwrite > each other in the > order they are written, i.e. > > Foo#foo overwrite Zak#foo > Foo_update#foo overwrite Foo#foo > > 'include module' include method in the super class. I guess you're not wrong. This is what I expect too. But the interesting point is this: class Bar < Zak def foo super end include Foo include Foo_update end So first Bar gets Zak's methods. Then I expect 'def foo' to overwrite and after that Foo.foo and Foo_update. So when Bar.foo is called, it be call to Foo_update#foo (holding the last definition), which super calls Foo#foo, which in turn calls Bar#foo and it finally calls Zak#foo. The prints indicate that actually Bar.foo is a call to Bar#foo and then the rest of the chain: Foo_update#foo, Foo#foo, Zak#foo. This means, that the source is actually magically transformed into following, before the order of the method overwriting is as in source. class Bar < Zak include Foo include Foo_update def foo super end end - Aleksi