lua-users home
lua-l archive

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



On 8-Jun-05, at 10:35 AM, Paul Chiusano wrote:

You could relax the requirement that the hash be perfect, if you put
objects with the same hash in a list, ensuring that the list contains
no duplicates according to equals. Maybe this is the most reasonable
workaround.

I am just used to python and java, where you can define your own
hashing and equals methods for each type of object. It seems like it
would be pretty easy to add a __hash metamethod to Lua... is there any
interest in implementing this, or some reason not to?


If you can construct hash functions and equality functions for your objects, why is it more difficult to stringify? Your __hash metamethod and __eq metamethod would have to be perfect, too, in combination.