lua-users home
lua-l archive

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


> Which makes me wonder... if table key comparison was extended to include
an
> "eq" metamethod would there be any remaining need for a "reference
> equivalence" test? It is not that unreasonable that two "__eq" values
might
> key the same for a table...

If you think about that for a minute, you will see how difficult
implementation would be. To make tables work, you need a hash function, and
writing hash functions to correspond with random __eq methods is
non-trivial. Otherwise, you would be reduced to a linear search of tables
for key equality on every lookup.

R.