lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


David Given wrote:
Another system I know of, which I haven't used and so might get completely wrong, involves having a chain of class objects each of whose metatable's __index field points at the superclass. This *doesn't* allow multiple inheritance unless you have a class whose __index field contains a dispatch routine that searches multiple classes... and this approach is slow enough as it is.

Right.  This is how I used to implement classes - then I went to
the copy-superclass-into-subclass approach you mentioned because it
really was noticably faster, and method-invokation is something that
happens a lot.  And as you say, multiple inheritance is easier that
way (I despite multiple inheritance in general, but admit there have
been nice cases where it really seemed the right thing to do).

Cheers,
--Adam
--
Adam D. Moss   -   adam@gimp.org