On 15/07/16 08:05 PM, Tim Hill wrote:
— What is the type of the return value? It can’t be any existing Lua
type, since this is *already* used as the identity of a value of that
type. In other words, if __key returns (say) 100 as the key, then that
will collide with using the number 100 in the same table. Not good. In
fact, the only thing that __key could conceivably return would be
another userdata pointer. And if you analyze this carefully, you will
see if doesn’t buy you any functionality over what you already have.
Not good? If you have a bigint with value 100, any reasonable person
would expect it to be compatible with a plain Lua number with value 100,
just like how the plain Lua integer 100 is compatible with the plain Lua
float 100.0. If Lua numbers have this property, why shouldn't other
things?