lua-users home
lua-l archive

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


Sean:

On Mon, Jun 24, 2019 at 1:06 AM Sean Conner <sean@conman.org> wrote:

>   Now that I think about it, why have __close at all?  Why not have locals
> marked as <toclose> just call __gc upon leaving scope?  It is to avoid
> possibly code breakage with for loops?

I, personally, assume no one is ever touching my data structures again
after __gc, and leave them in an invalid state ( yes, I know you can
resurrect them, but any competent programmer can crash a lib ). With
__close I will not assume that, I will leave them in a safe state, and
also assume __close can be called several times easily and make it
idempotent. In a lot of cases they will all be the same, but sometimes
they will not.

Francisco Olarte.