At 05:41 PM 11/11/2001 -0500, Michael G Schwern wrote:
>So when a variable is first created, all it has is a single bit
>representing it's refcount. When allocated, it's turned on. When it
>falls out of scope it's flipped off and swept away.
>
>When a variable is referenced a second time, it's transmogrified into
>a new structure that can support the necessarly more involved garbage
>collection system.
You can cheat a little more, even. Two bits (0, 1, 2, many) for refcount's
generally sufficient, and you can also then only bother incrementing it for
those operations that explicitly take a reference to something. That way
you reduce the cost of refcounting so it's only done when there's at least
a possibility that there's a reference involved at the language level.
(With lower-level pointer swapping being trackable by the compiler and
interpreter)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk