lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>>>>> "Coda" == Coda Highland <chighland@gmail.com> writes:

 >> There's a specific idiom that this kind of optimization would break,
 >> which is when one fetches a key or value from a weak table into a
 >> local variable purely to ensure it does not get collected during
 >> some process. In this case the local variable might never be
 >> referenced at all after assigning it.

 Coda> This is often called RAII ("resource acquisition is
 Coda> initialization" but the actual practice of it doesn't quite fit
 Coda> that exact description anymore).

 Coda> The solution is to assert that <toclose> variables are always
 Coda> considered live.

That is no use for this use case because it is not desired or expected
that the value be closed when the variable goes out of scope, just that
the strong reference to it is dropped.

-- 
Andrew.