[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: More implementation details :)
- From: Rici Lake <lua@...>
- Date: Fri, 20 Aug 2004 12:00:01 -0500
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.