[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Weak keyed tables with primitive keys
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 20 Oct 2009 16:14:13 -0200
> In my experience: numbers, strings, and boolean values aren't eligible
> for collection in this manner:
> I've never looked into the implementation reasons for this, but I
> suspect there's a fairly good reason =).
You will not find the reason in the implementation, quite the opposite.
See PiL Chapter 17:
Notice that only objects can be collected from a weak table. Values,
such as numbers and booleans, are not collectible. [...]
Strings present a subtlety here: Although strings are collectible,
from an implementation point of view, they are not like other
collectible objects. [...]