15 May 16:59
Re: Method lookup for modules included in modules
From: Mark Wilden <mark <at> mwilden.com>
Subject: Re: Method lookup for modules included in modules
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-15 14:59:06 GMT
Subject: Re: Method lookup for modules included in modules
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-15 14:59:06 GMT
On May 14, 2008, at 10:05 PM, ara.t.howard wrote: >> Here's my problem. If A1 doesn't contain the method, what causes >> the search to backtrack to the B proxy and follow its super pointer >> to the C proxy? This "backtracking" seems counter to the purported >> "linear" lookup order. (This is just a conceptual problem for me - >> it's obvious what the lookup order is, and it's easy to verify.) > > as each module in included in the target, it's entire lookup chain > is added to that target - therefore no 'backtracking' is required, > we just end up with a long line that, when followed, happens to give > the appearance if backtracking. I do understand that that's how it works in practice. I was trying to understand the process in terms of its implementation via proxies, klass, super and m_tbl. If it were truly implemented as a single long chain, then that would require (in my example) that the A2 proxy's super points to the B proxy. Hmmm....I wonder if that's indeed the case, as you imply? ///ark
RSS Feed