lua-users home
lua-l archive

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


On Mon, Nov 23, 2015 at 6:25 PM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:

> First, if the library does not protect metatables, any code can get the __gc metamethod and call it explicitly.

That requires a deliberate effort so whoever does that will face the consequences knowingly. And, as you say, it is still possible to protect the metatable from that. The problem with my original proposal was that it could result in this unknowingly, and without a way to prevent that.

> Second, it is a good practice (well, I think it is) to provide an explicit way to "close" an object that needs finalization.

I do not disagree.

Cheers,
V.