[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Weak set of strings
- From: Mark Hamburg <mhamburg@...>
- Date: Thu, 04 Nov 2004 18:00:24 -0800
I have need to create a weak set of strings -- i.e., I want to create a set
of strings where I can check to see whether a string is in the set but I
don't want to keep the string alive if the only reference is from the set.
For all garbage collected objects other than strings, a fully-weak table
using keys to hold the set elements and true as the value would do the job
nicely.
Strings, however, don't seem to work this way presumably out of concern that
strings can be recreated later and would still need to map to the same
value. Is that concern, however, really worth making strings behave
differently with regard to weak tables? This would presumably also make a
cache mapping file names to file contents fail to function correctly if both
sides were represented as strings.
Mark