[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua 5.2 beta manual clarifications on GC and finalizers
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 5 Sep 2011 12:08:01 -0300
> [These are questions I think should be answered by the Manual. Not
> questions that I have.]
> o Can a "resurrected" object (finalizer saves a strong reference to
> the object) be finalized more than once?
> o In this paragraph:
> "Objects marked for finalization have a special behavior in weak
> tables. When a marked object is a value in a weak table, it is removed
> from the table before running its finalizer. However, when it is a
> key, it is removed from the table only after running its finalizer.
> This behavior allows the finalizer to access properties associated
> with the object through weak tables."
> Is the object removed from the weak table even if the finalizer
> "resurrects" the object? If not, it probably should be emphasized that
> the userdata is always removed when it is a value in a weak table.
Programs should never resurrect objects. So, I think that the less
details we give the better.