chicken-hackers
[Top][All Lists]
Advanced

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

How should we deal with weak refs to finalizable objects? (was: Re: [PA


From: felix . winkelmann
Subject: How should we deal with weak refs to finalizable objects? (was: Re: [PATCH] Bugfix and drop weak references to finalizable objects (was: Re: [PATCH] thread-safe handling of asynchronous events))
Date: Mon, 10 Jul 2023 21:28:19 +0200

After thinking some more about this, I realize that your approach
(clearing weak ref's to finalized data) is the right thing, since
any other behaviour in the presence of multithreading leads to
disaster.

Let me elaborate.

Finalization is a time of reckoning, a purgatory where an object
undergoes a final cleansing of possibly sinful state, of references
to things foreign and alien, the dirty underbelly of an objects
existence that must be brought to order in ways only the user can
truly know about. Since the object is in this state, all its wordly
connections have already ceased to exist, its identity forgotten
(or it wouldn't be ready for reclamation).

But what if other threads access a weakly remembered object
while it is in purgatory? They would deal with an empty husk, a ghost,
likely to be devoid of the things (external pointers and other resources)
that define its true self, a mere shadow, with consequences that do not
have to be explicitly mentioned here and are better left unsaid.

Should the user (for reasons we can and must never know) decide that
the object is not ready yet to go to the other world and should stay
for another cycle of suffering in this earthly existence and store the
value in some external location, then the object will internally be
the same and have the same true identity, but external pointers will
have ceased to exist. Strong references are already ensured to be gone
and weak references are cleared using the incantations that sjamaan
(in his wisdom) proposed (certain enlightened objects that have a
sufficiently advanced self conciousness may know their true identity,
i.e. keep circular references to itself, but these must necessarily be
internal and are irrelevant when seem from outside).

So reincarnation means the object _is_ identical, but the nature
of its identity is invisible to the outside world. Enlightened objects
may know about their true identity but trying to communicate that
beyond its inner self is meaningless when seen from the outside.

I think this clears things sufficiently up.


felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]