comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Task origin track from a class
Date: Wed, 13 Jul 2011 13:59:13 +0200
Date: 2011-07-13T13:59:13+02:00	[thread overview]
Message-ID: <bls70wenmiwd.1w4ux6l4o9qlc.dlg@40tude.net> (raw)
In-Reply-To: 4e1d5aa3$0$6544$9b4e6d93@newsspool4.arcor-online.net

On Wed, 13 Jul 2011 10:43:15 +0200, Georg Bauhaus wrote:

> On 7/13/11 9:41 AM, Dmitry A. Kazakov wrote:
>> On Tue, 12 Jul 2011 17:36:29 -0700 (PDT), Shark8 wrote:
>>
>> The actual problems are:
>>
>> 1. The procedure of destruction of the objects having task components.
>> Tasks are completed *before* Finalize is called. Ada's approach to
>> construction/destruction is very much broken.
> 
> When the life time of objects is determined by Ada's
> language rules (and not by the type system), isn't it
> normal to expect that the language defined wrecking
> ball smashes the thing only after it has finished?

Finalize is expected to have the object fully operational if called for the
first time. Which is not the case for the task components.

> What would be the alternative?  Would it be that the
> programmer then has to actively manage all parts of
> destruction  himself?

Not at all. The alternative is for the user-defined
constructor/destructor's hook to meet all components valid when called.
Finalize is not such a hook.

> When an implementation collects garbage, when would
> the "destructor" run?

The destructor of the type T to be called before the memory allocated for
the object loses its attribution to the type T. Note that this does not
imply deallocation. For instance when S is demoted to its base type T, the
destructor of S must be called to make a T out of S.

>  Do finalization and RAII destruction(?)
> have to be separate things?

Finalization is another word for destruction. (I am not a language lawyer
and don't about what RM might say about it)

Again, observe that promotion requires a partial construction while
demotion does a partial destruction. The primitive operation Finalize is a
partial destructor. A complete destruction includes the bodies of the
Finalize from all bases and destructors of all components.

Note also that a consistent model must also provide hooks for
promotion/demotion to the class (e.g. S -> T'Class, T'Class -> S).

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  reply	other threads:[~2011-07-13 11:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12  3:24 Task origin track from a class Rego, P.
2011-07-12  5:57 ` Simon Wright
2011-07-12  7:41 ` Dmitry A. Kazakov
2011-07-12 10:29   ` Simon Wright
2011-07-12 10:31     ` Simon Wright
2011-07-13  0:36       ` Shark8
2011-07-13  2:57         ` Rego, P.
2011-07-13  7:41         ` Dmitry A. Kazakov
2011-07-13  8:43           ` Georg Bauhaus
2011-07-13 11:59             ` Dmitry A. Kazakov [this message]
2011-07-13 16:31           ` Shark8
2011-07-13 17:22             ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox