lua-users home
lua-l archive

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


>>>>> "Sean" == Sean Conner <sean@conman.org> writes:

 >>>> An object reference may be abandoned as soon as the program gets
 >>>> to the point where it will no longer need the object for its
 >>>> normal execution (i.e. ignoring the effects of weak references and
 >>>> finalizers). The finalizer can run any time after that (1ns or 1
 >>>> year later).

 Roberto> +1.
 
 >> So if one needs to prevent an object's removal from a weak table
 >> during the execution of a block of code, how should it be done, if
 >> simply assigning the value to a local isn't enough?

 Sean> Assigning it to a local is enough to keep it from being removed
 Sean> from a weak table.

I think you're missing the point - it's enough _now_, it's not enough in
the presence of hypothetical optimizations that treat a variable as dead
after it is referenced for the last time.

-- 
Andrew.