|
On May 20, 2014, at 6:49 PM, Philipp Janda <siffiejoe@gmx.net> wrote:
I’m not sure this is true; the Lua docs say “in the reverse order they were marked for COLLECTION” (not finalization). So my reading is that the order depends entirely on the order in which the GC determines objects to be unreachable, and (in my reading of it at least) I don’t see a clear guarantee of that ordering in the docs. In any case, imho it’s very bad to depend on the ordering of finalizer calls in any garbage-collected language. If you really have two objects that depend on finalizer ordering then I think you really have a single dispose function that cleans up BOTH at once and can be called from either finalizer, which is much more robust. —Tim |