[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Strings in weak tables
- From: Mark Hamburg <mhamburg@...>
- Date: Wed, 29 Aug 2007 08:39:41 -0700
on 8/28/07 1:07 PM, Roberto Ierusalimschy at firstname.lastname@example.org wrote:
>> While I understand the reasoning for making strings act like values with
>> respect to weak tables, it can be a problem when dealing with computed
>> strings. For example, I might want to cache SQL statements and their
>> compiled form for SQLite.
> Is the compiled form a string too?
No. It's a userdata object.
I'm looking at using as a heuristic for caching that if some piece of code
is hanging onto the string, then it is likely to make the query again. On
the other hand, if there are no other references to the string, then it was
probably a one-off construction.