From: SunRaySon Date: 2007-03-23T02:31:56+09:00 Subject: Re: What is the problem with this module function. Thanks for the clarification. Now I am just curious to know if there is any way I can call the module function foo from instance a1. Also is there any reason why mixin modules are looked upon first before looking at superclasses, again I am mistaken here I was opinion that it would be supreclass and then mixin modules. Kiran Kumar. On 3/22/07, Ron Hopper wrote: > On 3/22/07, SunRaySon wrote: > > > > > > I am expecting it to print ModuleA::foo because the method foo in > > ModuleA would overwrite the method foo when I include ModuleA after > > reopening the class A later. Am I missing something here, can anyone > > help me understand this. > > > > Kiran Kumar > > > > > > Kiran, > > You are mistaken about the method lookup precedence in Ruby. The method is > first looked up in the class, then mixin modules, then superclasses, etc. > > Therefore, the class definition of "foo" is masking the module definition of > "foo", not the other way around. > > - chopper >