From: "SHIGETOMI, Takuhiko" Date: 2005-09-12T13:07:46+09:00 Subject: Re: [Q] how to well-qualify the 2-inherited methods at their collision point David, greetings. thank you for your code and adjustment to my recognition. > I don't think you can. However... does this help? > > class SubClass < BaseClass > MyBaseModule = BaseModule.dup > module MyBaseModule > def greeting > super > end > end > include MyBaseModule > end > > or, more concisely: > > class SubClass < BaseClass > include BaseModule.dup.module_eval { > def greeting > super > end > self > } > end oh! we can customize any module as the 1st class object. and your 2nd sample code has a scent of java slightly :-) this is good for after-lunch. > > def greeting # <== collision point of 2-inherited 'greeting' > > Hmmmm.... I don't really think it's a collision. It's more like > they're layered. Understandably, Ruby thinks that if you redefine a > method later in the method lookup path, you *want* it redefined :-) it's not a collision but layered! make sense. this adjustment helps me to understand the later Trans's mail more. > I think it's better to have it all controlled by the object. Whatever > the object thinks "greeting" means, that's what it means. "super" > (jumping one level from a method definition body) makes sense because > when you redefine a method, you are adding one and only one layer. So > you're "allowed" to know that there is one previous layer; that just > means you know that you're redefining a method, not defining a new > one. But beyond that it I think absolute paths like that would lead > to tightly coupled class and module designs. i understood. that's true. i agree. i this matter, what i'd like to do is not a jump but a branch. so, your code helps me a lot. > > any hacky way would be welcome. > > Glad to hear it, considering what I wrote in the code above :-) your's not so hacky, since it is enough self-descriptive, i think. cigp://void/3d/universe/milky-way-galaxy/orion-arm/sol-solar-system/ 3rd-planet/fareast/jp/tky/shigetomi.takuhiko.5618