No registered users in community xowiki
in last 10 minutes
in last 10 minutes
Re: [Xotcl] Object destruction on exit
From: Kristoffer Lawson <setok_at_fishpool.com>
Date: Sat, 4 Feb 2006 12:39:58 +0200
On 3 Feb 2006, at 17:11, Gustaf Neumann wrote:
> Kristoffer Lawson schrieb:
>
>>
>> Well this generally happens automatically anyway. If they are
>> resources for which this does not happen, can we be sure that this
>> is what the programmer wants?
>
> consitency is important.
> in oo-systems, the programmer has a "contract" with the system,
> that for every object
> the life-cycle starts with the constructor and ends for the
> destructors.
> This is simlar to finalize() in java.
> normally, you do not want to distinguish btwn. "manual" and
> "automatic" destroys (which happen
> btw. in various situations).
I would say this depends very much on your point of view. In systems
with prevalent persistence then the existence of an object continues
until it is explicitly destroyed. Ie. automatic destruction does not
occur. You can few objects in two different ways, as in-memory
entities they exist only as long as the application exists. But you
can also take the view that the in-memory entities are just
representations of the actual object, which resides also on disc.
> You cound do e.g.
>
> ::xotcl::Object setExitHandler {set ::xotcl::onEXIT 1}
>
> and check this variable from the destroy method whether or not the
> db-instance
> should be deleted.
Yes, this could be one possible way round that.
/ http://www.fishpool.com/~setok/
Date: Sat, 4 Feb 2006 12:39:58 +0200
On 3 Feb 2006, at 17:11, Gustaf Neumann wrote:
> Kristoffer Lawson schrieb:
>
>>
>> Well this generally happens automatically anyway. If they are
>> resources for which this does not happen, can we be sure that this
>> is what the programmer wants?
>
> consitency is important.
> in oo-systems, the programmer has a "contract" with the system,
> that for every object
> the life-cycle starts with the constructor and ends for the
> destructors.
> This is simlar to finalize() in java.
> normally, you do not want to distinguish btwn. "manual" and
> "automatic" destroys (which happen
> btw. in various situations).
I would say this depends very much on your point of view. In systems
with prevalent persistence then the existence of an object continues
until it is explicitly destroyed. Ie. automatic destruction does not
occur. You can few objects in two different ways, as in-memory
entities they exist only as long as the application exists. But you
can also take the view that the in-memory entities are just
representations of the actual object, which resides also on disc.
> You cound do e.g.
>
> ::xotcl::Object setExitHandler {set ::xotcl::onEXIT 1}
>
> and check this variable from the destroy method whether or not the
> db-instance
> should be deleted.
Yes, this could be one possible way round that.
/ http://www.fishpool.com/~setok/