comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pogner.demon.co.uk>
Subject: Re: Safety of the Booch Ada 95 Components
Date: 1999/12/13
Date: 1999-12-13T00:00:00+00:00	[thread overview]
Message-ID: <x7vvh62384v.fsf@pogner.demon.co.uk> (raw)
In-Reply-To: 1e2pka4.nppns21okbh5cN%herwin@gmu.edu

herwin@gmu.edu (Harry Erwin) writes:

> Simon Wright <simon@pogner.demon.co.uk> wrote:
[...]
> > > Apparently in the Booch components, if the copy goes bad, the To
> > > container has been cleared and is partially written. Basic exception
> > > safety (== the container is still useable) is probably supported.
> > 
> > Yes, this is the case for the Copy operation (which is *not* the
> > standard assignment operation!).
> 
> What is the standard assignment operation, then?  I'm new to Ada 95.  In
> C++ 99, we rarely trust the compiler-defined default versions of copy
> constructors and assignment operations, because they do bit-by-bit
> copies. 

The standard Ada assignment operation is :=

However, it's not an operation that you have control over in the way
that C++ gives you with operator=.

What you do have is Controlled types (types that inherit from
Ada.Finalization.Controlled).

From ALRM,

7.6 User-Defined Assignment and Finalization

(1) Three kinds of actions are fundamental to the manipulation of
     objects: initialization, finalization, and assignment. Every
     object is initialized, either explicitly or by default, after
     being created (for example, by an object_declaration or
     allocator).  Every object is finalized before being destroyed
     (for example, by leaving a subprogram_body containing an
     object_declaration, or by a call to an instance of
     Unchecked_Deallocation). An assignment operation is used as part
     of assignment_statements, explicit initialization, parameter
     passing, and other operations.

(2) Default definitions for these three fundamental operations are
     provided by the language, but a controlled type gives the user
     additional control over parts of these operations. In particular,
     the user can define, for a controlled type, an Initialize
     procedure which is invoked immediately after the normal default
     initialization of a controlled object, a Finalize procedure which
     is invoked immediately before finalization of any of the
     components of a controlled object, and an Adjust procedure which
     is invoked as the last step of an assignment to a (nonlimited)
     controlled object.

[...]

(17) For an assignment_statement, after the name and expression have
     been evaluated, and any conversion (including constraint
     checking) has been done, an anonymous object is created, and the
     value is assigned into it; that is, the assignment operation is
     applied. (Assignment includes value adjustment.) The target of
     the assignment_statement is then finalized. The value of the
     anonymous object is then assigned into the target of the
     assignment_statement. Finally, the anonymous object is
     finalized. As explained below, the implementation may eliminate
     the intermediate anonymous object, so this description subsumes
     the one given in 5.2, ``Assignment Statements''.

I don't think there's a web version of the ALRM at
www.adapower.com. There is one at www.adahome.com (no longer
maintained, it seems, but still with goodies like this).




  reply	other threads:[~1999-12-13  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-10  0:00 Safety of the Booch Ada 95 Components Harry Erwin
1999-12-10  0:00 ` Simon Wright
1999-12-12  0:00   ` Simon Wright
1999-12-12  0:00     ` Matthew Heaney
1999-12-12  0:00   ` Harry Erwin
1999-12-13  0:00     ` Simon Wright
1999-12-10  0:00 ` Matthew Heaney
1999-12-10  0:00   ` Hyman Rosen
1999-12-10  0:00     ` Harry Erwin
1999-12-10  0:00     ` Matthew Heaney
1999-12-11  0:00       ` Harry Erwin
1999-12-12  0:00         ` Robert Dewar
1999-12-12  0:00           ` Harry Erwin
1999-12-13  0:00           ` Kent Paul Dolan
1999-12-13  0:00             ` Simon Wright
1999-12-13  0:00             ` Ted Dennison
1999-12-13  0:00             ` Robert I. Eachus
1999-12-13  0:00       ` Hyman Rosen
1999-12-13  0:00         ` Robert I. Eachus
1999-12-14  0:00           ` Simon Wright
1999-12-15  0:00             ` Mats Weber
1999-12-17  0:00               ` Simon Wright
1999-12-15  0:00             ` Harry Erwin
1999-12-14  0:00         ` Matthew Heaney
1999-12-10  0:00   ` Harry Erwin
1999-12-12  0:00     ` Simon Wright
1999-12-12  0:00       ` Harry Erwin
1999-12-13  0:00         ` Simon Wright [this message]
1999-12-13  0:00 ` Tucker Taft
replies disabled

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