lua-users home
lua-l archive

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


Am 24.11.2015 um 17:28 schröbte Viacheslav Usov:
On Tue, Nov 24, 2015 at 5:16 PM, Patrick Donnelly <batrick@batbytes.com>
wrote:
All libraries should handle closed objects robustly for all methods.

I do not disagree with the "should" part of that.

I do not think the sentence is correct if it loses "should". The proposed
alternative, ref counting, does block scope finalization without breaking
any existing code.

The two things are unrelated. Currently you can access a finalized object by iterating the keys of a weak table. This case should be handled in all libraries. Adding ref counting wouldn't unbreak the currently broken libraries.

And adding ref counting might break existing code: a simple `lua_replace()` can now run finalizers and thus raise errors and cause leaks in the C code.


Cheers,
V.


Philipp