From: David Flanagan Date: 2009-05-14T07:20:02+09:00 Subject: Re: Superclass of eigenclass On May 12, 9:29 am, Danny O cuiv wrote: > Gary Wright wrote: > > Confusion comes from: > > -- the super keyword uses the method lookup chain, not thesuperclass > > chain > > -- the ancestor method reports on the method lookup chain, not the > > inheritance chain I have to disagree with Gary's nomenclature. Inheritance and method lookup are basically the same thing, so trying to distinguish "method lookup chain" from "inheritance chain" is hard to do. Maybe we can say "class hierarchy" when we want to exclude modules as the superclass method does and "method inheritance chain" (or something) when we want to include modules. > Aaaah! The penny finally drops! Thanks a million for this, Gary. I think > I'd have been banging my head against a brick wall for ages without your > explanation. > > I'd probably still stand by my earlier assertion that it's a conceptual > mess, however. It's just that now that I know what the semantics really > are, I can work with it. Bad naming trips up even very experienced > people. For example, in RPL, no lesser luminaries than David Flanagan > and Matz write on page 238 that super "invokes a method with the same > name as the current one, in thesuperclassof the current class". You're right. I should have said something like "in the nearest ancestor of the current class" or something to that effect, so that modules are included. I may also want to update this paragraph to point out that a singleton method of an object can chain to a regular instance method of the object. Thanks for pointing out this error! > That said, for my own purposes, I now have a pretty good picture of the > semantics (naming snafus and all) and can definitely work with that > picture. So thanks again. > > Regards, > > Danny > > -- > Posted viahttp://www.ruby-forum.com/.