comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Accessing finalized values
Date: Mon, 6 May 2013 11:52:18 +0200
Date: 2013-05-06T11:52:18+02:00	[thread overview]
Message-ID: <5ryqq4azptqx.1evdyl7lvwwg2$.dlg@40tude.net> (raw)
In-Reply-To: 7a248ba5-9fbc-4326-bbb8-eec3c125d455@googlegroups.com

On Sun, 5 May 2013 08:00:18 -0700 (PDT), sbelmont700@gmail.com wrote:

> If the whole purpose of Finalize is "to ensure that proper cleanup is
> performed prior to the object becoming permanently inaccessible",

Finalize is a hack. It is not suitable to play the role of a destructor,
though in some cases it could.

> but its
> perfectly legitimate to access the object after Finalize has been called,

That depends on the role Finalize to play. There is no language guarantee
for Finalize to act as a destructor, which would mean in particular that no
operation of the type T will be called after destruction of T.

BTW, this does not imply you could not access operations of its parent
types. That happens only after the parent's destructor is done.

If you want Finalize to act as a destructor it becomes your responsibility,
because the language lend very little support here.

> then writing 110% bulletproof code becomes much more complex.  How is an
> object supposed to free its resources if the resources must still be made
> available?

It must not, because the language does not require either behavior. E.g.
task components are not available after Finalize in the sense that you
cannot call to their entry points. Though you still can query some
attributes of. As others have pointed out you have to add some additional
logic in order to make working better. You will never have a bulletproof
code because construction/destruction in Ada is broken/unsupported in too
many places.

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



  parent reply	other threads:[~2013-05-06  9:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 21:00 Accessing finalized values sbelmont700
2013-05-02 22:47 ` Adam Beneschan
2013-05-03 22:36 ` Randy Brukardt
2013-05-05 15:00   ` sbelmont700
2013-05-06  5:45     ` J-P. Rosen
2013-05-06  8:59     ` Stephen Leake
2013-05-06  9:52     ` Dmitry A. Kazakov [this message]
2013-05-06 20:05       ` sbelmont700
2013-05-07  0:51         ` Randy Brukardt
replies disabled

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