comp.lang.ada
 help / color / mirror / Atom feed
From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: Accessing finalized values
Date: Mon, 06 May 2013 07:45:35 +0200
Date: 2013-05-06T07:45:35+02:00	[thread overview]
Message-ID: <km7frc$qo2$1@dont-email.me> (raw)
In-Reply-To: <7a248ba5-9fbc-4326-bbb8-eec3c125d455@googlegroups.com>

Le 05/05/2013 17:00, sbelmont700@gmail.com a �crit :
> Pathological seems like an understatement; it seems like a pretty
> major catch-22.  If the whole purpose of Finalize is "to ensure that
> proper cleanup is performed prior to the object becoming permanently
> inaccessible", but its perfectly legitimate to access the object
> after Finalize has been called, 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?
> 
> For instance, suppose finalization for a File type closes the file;
> if it has to assume that other code might call Read and Write
> subprograms after Finalize has been executed, the file must stay open
> and the point is moot (or it must add preconditions to every
> operation).  It would seem like the same rules for protected types
> should apply to non-protected types as well, for all the same
> reasons.

From a /language/ POV, calling a controlled object after finalization is
allowed. It means that it is up to you to add checks if necessary. In
your example, you would close the file in Finalize, and raise
Program_Error if the local file is closed.
-- 
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr



  reply	other threads:[~2013-05-06  5:45 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 [this message]
2013-05-06  8:59     ` Stephen Leake
2013-05-06  9:52     ` Dmitry A. Kazakov
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