lua-users home
lua-l archive

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


Hi Alladin.

On Dec 30, 2007 2:32 PM, Aladdin Lampé <genio570@hotmail.fr> wrote:
> Peeking at the code, I understand why this happens, but I can't think of a simple patch, which wouldn't break the design goal of dynamicity of Renato's library.
> Does somebody have any idea how to solve this? Renato, maybe? :-)

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.

Best regards.

-- 
Renato Maia
PhD student at PUC-Rio
__________________________
http://www.inf.puc-rio.br/~maia/