lua-users home
lua-l archive

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


This becomes very attractive but it also further emphasizes that tuples are
not functions even if you can make functions behave almost like tuples.

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.

Mark

on 8/20/04 10:00 AM, Rici Lake at lua@ricilake.net wrote:

> Speaking of immutable objects and interning, there is an interesting
> intermediate possibility: lazy interning.
> 
> Basically, an immutable object can be interned when an attempt is made
> to
> use it as a table key (and possibly when any equality comparison is
> done).
> This might be useful, for example, for immutable vectors representing
> points,
> rectangles, or colours.
> 
> This wouldn't work with character strings, without taking some care,
> because
> the C API relies on character strings not moving around. However, it
> would
> work on an immutable object whose elements could only be accessed
> through
> some API call; an immutable tuple of full Lua objects would have to be
> of
> this form.
> 
> R.
>