lua-users home
lua-l archive

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


Renato Maia <maia <at> inf.puc-rio.br> writes:
> I think you can change Lua so fields of a metatable can be supplied by
> a '__index' field of its own metatable. But my "pure-Lua" solution is
> to use the 'cached' class model of LOOP. In this model, class fields
> are copied through out the hierarchy thus all inherited fields are
> copied to each class (i.e. metatable). The dynamicity problem is
> solved by the use of "class proxies" instead of the metatable itself
> to represent a class. These proxies intercept any change applied to
> the class and update its subclasses properly. The use of these proxies
> slow down operations on classes (e.g. introspection operations), but
> it shouldn't be a problem if such operations are not frequent.

Thanks a lot Renato for this explanation. I don't want to interfere with the 
way Lua treats metamethods, so I'll try your cached model that I found at 
first sight a bit over-complicated for my needs. It really seems to be the way 
to go. Thanks again.

Happy new year and best wishes,
Aladdin