lua-users home
lua-l archive

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


On Wed, Oct 24, 2012 at 12:50 PM, Thijs Schreijer
<thijs@thijsschreijer.nl> wrote:
> And a devil in the details of argument checking; should the MT chain be
> traversed to see whether a subclass satisfies as a class higher up in the
> hierarchy

Ah, but again there are different ways to peel the avocado.  An MT
chain is one way, but I tend to use 'fat metatable inheritance' where
the contents of the base class is copied into the new derived class,
with a _base field pointing to the original base class.  Faster method
dispatch for the price of larger metatables - a good trade-off if the
number of objects outnumbers the number of classes significantly.

> maybe that requires an __istype() or similar  function as well.

That would be best, and would depend on the OOP scheme being used.

steve d.