[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: breadth-first search through multiple inheritance hierarchy??
- From: "Leo Razoumov" <slonik.az@...>
- Date: Tue, 26 Sep 2006 18:55:24 -0400
On 9/26/06, Rici Lake <email@example.com> wrote:
Breadth-first may not be what you want, either, but in any event to
implement it you need to bypass the Lua __index mechanism, since you
need an actual tree of inheritances.
However, you might want to look at this paper:
which discusses various algorithms for ordering inheritance orders.
C3 was the algorithm selected for Python, I believe.
Doing this computation dynamically is probably too time-consuming;
either the computation should be done when the class is created, or
when it is first needed.
I am planning to do memoizing, i.e. after first successful search in
the hierarchy the element found (or method or whatever) is added to
the metatable of the calling object so that next time one does not
need to traverse the entire inheritance tree again.