comp.lang.ada
 help / color / mirror / Atom feed
From: Tucker Taft <stt@averstar.com>
Subject: Re: Unreferenced lock variables
Date: 1999/04/16
Date: 1999-04-16T00:00:00+00:00	[thread overview]
Message-ID: <37179A21.82A1AF7@averstar.com> (raw)
In-Reply-To: 3717869e.7448255@news.pacbell.net

Tom Moran wrote:
> 
> I found AI-00147, which as far as I can see gives no significant
> arguments *for* eliminating in the non-limited case, except "doing
> Initialization/Finalization is expensive".  It seems to that either
> the programmer intended the object to be declared, even though he
> doesn't use it, or it was a mistake on his part and a warning should
> be generated (as for unused Integer, Boolean, and other non-controlled
> types).  So possibly such a warning in the non-limited case would be
> reasonable, but simply assuming the programmer did not really intend
> to declare the controlled object, is hubris.
>   Or is there another AI that I missed?

Here is a motivating example:

    X : My_Controlled_Type;
  begin
    ...
    X := Y;
    ...
  end;

Presuming My_Controlled_Type has a user-defined Initialize,
Finalize, and Adjust, the sequence of implicit calls currently 
required is:
    Initialize(X);
     ...
    Finalize(X)
    <copy Y to X>
    Adjust(X)
    ...
    Finalize(X)

The goal is to eliminate the first Initialize/Finalize pair.
Doing this requires some care, because if an exception is raised
before the assignment of Y to X, you don't want X to be finalized
if it has never been initialized.

Perhaps one way to resolve the concern is to give the permission
to remove an Initialize/Finalize pair only if there is an assignment
(presumably with Adjust) to the object, essentially allowing
the creation of the object to be deferred until the first assignment,
thereby bypassing the need for any default initialization.

-Tuck
-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Distributed IT Solutions  (www.averstar.com/tools)
AverStar (formerly Intermetrics, Inc.)   Burlington, MA  USA




  reply	other threads:[~1999-04-16  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-11  0:00 Unreferenced lock variables Simon Wright
1999-04-11  0:00 ` Tom Moran
1999-04-12  0:00 ` Robert Dewar
1999-04-12  0:00   ` Simon Wright
1999-04-12  0:00     ` Robert Dewar
1999-04-12  0:00       ` Simon Wright
1999-04-14  0:00         ` Robert Dewar
1999-04-12  0:00       ` Jean-Pierre Rosen
1999-04-12  0:00         ` Simon Wright
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00         ` Robert Dewar
1999-04-13  0:00       ` Tom Moran
1999-04-15  0:00         ` Robert Dewar
1999-04-15  0:00           ` Tom Moran
1999-04-16  0:00             ` Robert Dewar
1999-04-16  0:00               ` Tom Moran
1999-04-16  0:00                 ` Tucker Taft [this message]
1999-04-16  0:00                   ` Tom Moran
1999-04-16  0:00                   ` Tom Moran
1999-04-19  0:00                     ` Tucker Taft
1999-04-20  0:00         ` Tom Moran
1999-04-20  0:00           ` Robert Dewar
1999-04-20  0:00             ` Tom Moran
1999-04-21  0:00               ` Robert Dewar
replies disabled

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