[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Weak keyed tables with primitive keys
- From: Sam Roberts <vieuxtech@...>
- Date: Tue, 20 Oct 2009 08:53:25 -0700
On Tue, Oct 20, 2009 at 8:04 AM, Gary Bringhurst <firstname.lastname@example.org> wrote:
> Where can I find a definitive discussion of weak keyed tables and the
> behavior of primitive data types as those weak keys? My tests say that
> unique string keys are never collected, and while I can see a justification
> for that I'd really like to know the relationship of primitive types such as
> strings to the garbage collector. Do we have to use tables or user data as
> keys in weak keyed tables in order for them to be collected?
When you do
t["hi"] = "bye"
both the key and the value are being put into the table, why would
either get collected? If a key was collected, it wouldn't be in the