lua-users home
lua-l archive

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


Mike Pall <mikelu-1101 <at> mike.de> writes:
> But it's unclear how far one should take this. Lua tables are fast
> because they are (mainly) based on object identity and not on
> object equality. Once I add int64_t hash equality, somebody will
> ask for hash equality for complex numbers, then for structs and
> then ask for a __hasheq metamethod. Java hash tables are slow
> because they need to take into account all of this.

Speaking as someone who has previously asked for a __hasheq
metamethod [0], I got over it, and I would hate for this slippery
slope worry to lead to semantics where:

  1 == 1LL
  t[1] != t[1LL]

That sounds extremely counter-intuitive.  I think a convincing
response to anyone who asks to push this further is that table
indexing follows the same rules as "==", and you've already
concluded that "==" needs to work with 64-bit integers.

Josh

[0] http://thread.gmane.org/gmane.comp.lang.lua.general/52914