lua-users home
lua-l archive

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


> >That is, I'm sorry, but I fail to see why one might need a __removeindex
> >metamethod.
> 
> That's because you didn't try removing an index :)

True enough. :) I missed your point, but now I think the main issue here is
that for tables, if table[key] ~= nil, key/value access metamethods (__index
and __newindex) are not called; this would have to change with a new
__removeindex, and, if so, why not simply use __newindex?

I'm assuming that no "halfway" solutions are to be adopted: either we adhere to
the current table access policy and use proxies when necessary or we rely on
metamethods for more elaborate table access at the cost of losing some
efficiency due to more table lookups. IMHO, the actual approach is better
since it's more efficient and fosters the elegant use of proxies.

Cheers,
Luis.

-- 
A mathematician is a device for turning coffee into theorems.
        -- P. Erdos 

-- 
Luis Carvalho
Applied Math PhD Student - Brown University
PGP Key: E820854A <carvalho@dam.brown.edu>