lua-users home
lua-l archive

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


David Manura wrote:
>[...]
> As seen, if a set "s" has a method "union", this implies that
> s['union'] is true.  For such reason, Penlight [1] avoids using the
> index operator for membership tests in its set and map ADTs.  Also, if
> we use the common technique of storing methods in the metatable
> ("set_mt.__index = set_mt" above), then s['__index'] is not nil
> either, a subtle potential bug or security hole.

And that's the reason why I changed the colon to be an operator
like '.' which looks in the object's metatable (and may trigger
__index/__newindex calls in the metatable's metatable) instead
of the object itself.

A drastic change but I'm happy with it ...

Ciao, ET.