lua-users home
lua-l archive

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


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.

> Using finalizers to modify the state of your program outside of the object that became unreachable is going to end in tears, unless you are very careful, you end up with a program whose behavior will be difficult to analyze because the finalizer can run at almost any point in your program, not just at statement boundaries.

This I know, and I have no problem with it. Because my finalizers do
not make nearly any asumption about the program state besides what
they have stored. BUT the rest of the code assumes the finalizers are
NOT run while they keep the object alive according to the definition
in 2.5.

Also, what is "the state of a program outside the object". Is closing
an OS handle part of an object state? In informal discussions you
consider this part of it, but it is really an observable side effect.

Of course my toy examples with nasty global data are convoluted, but
they are there to simplify the exposition, I'm not going to put some
thousands lines to demonstrate real life problems with them.

I do not need any change, I think lua does it right, accesible=live,
live=not collectable, simple, easy to get right, I've had no problems
with that.

Francisco Olarte.