lua-users home
lua-l archive

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



On 20-Aug-04, at 1:56 PM, Mark Hamburg wrote:

I also think that once one uses tuples for table keys, it will become
necessary to address the notion of weak tuples in some way which again
complicates matters and makes them more not like functions.


I really don't think that a weak immutable tuple has any meaning.

Consider:

function foo()
  local myObject1, myObject2 = {}, {}
  a = weaktuple(3, myObject1)
  b = weaktuple(3, myObject2)
  return a, b
end

Now, is a == b? Depends whether garbage collection has happened or not. That is
intolerable if they are used as table keys.

If tuples were mutable, this would be different, because equality would be defined by object identity. But weak values are counter to the concept of
immutability.