lua-users home
lua-l archive

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


Le lun. 3 juin 2019 à 11:33, Francisco Olarte <folarte@peoplecall.com> a écrit :
Gé:

On Mon, Jun 3, 2019 at 4:54 AM Gé Weijers <ge@weijers.org> wrote:
> The idea that every object reference must be assigned a slot that lasts until the end of a block/call is not required anywhere outside of the C interface of the PUC Lua implementation, you're making unwarranted assumptions about how things should work.

I'm asuming when the PUC guys say "accesible=live" they mean it, I'm
not even assuming slots or anything similar exists.

> An object reference may be abandoned as soon as the program gets to the point where it will no longer need the object for its normal execution (i.e. ignoring the effects of weak references and finalizers). The finalizer can run any time after that (1ns or 1 year later).

As soon as PUC puts that "normal execution" stuff in the manual, ok. I
now the finalizer can run at anytime AFTER it becomes inaccesible, I
DO NOT assume it runs promptly. But, knowing the finalizers are NOT
run while the object is accesible is needed to me.

That's probably because  your varaible acts only as a proxy for a remote object which has an external lifetime or state (and you use the finalizer with an explict call to the garbage collector to close the remote session): your design is bogous if your program does not handle it with a session; your variable should then be an object that has a reference from a session object. Using finalizers for this is bad, especially in Lua. Please use a session object and control that session explicitly with a separate variable.