comp.lang.ada
 help / color / mirror / Atom feed
* Order of subcomponent finalization
@ 1999-03-16  0:00 adam
  1999-03-16  0:00 ` Tucker Taft
  0 siblings, 1 reply; 2+ messages in thread
From: adam @ 1999-03-16  0:00 UTC (permalink / raw)


Suppose a record type and an object of that type are declared:

procedure Subp is

    type Rectype is record
        Component_1 : Controlled_Type_1;
        Component_2 : Controlled_Type_2;
    end record;

    R : Rectype;

begin
...
end Subp;

where Controlled_Type_1 and Controlled_Type_2 are controlled types (duh).

According to 7.6(12), R.Component_1 and R.Component_2 are initialized
in arbitrary order (since neither one has an access discriminant
constrained by a per-object expression).  But does the RM specify in
which order the components are finalized when Subp exits?  7.6.1(9)
says similarly that the components of a composite type are finalized
in arbitrary order; but 7.6.1(11) says that objects created by
declarations in a master (in this case Subp) are finalized in the
reverse order of their creation, and 3.3(12) says that R.Component_1
and R.Component_2 are objects (although whether they count as "objects
created by a declaration is unclear to me, especially after reading
3.3.1(16-19)).  So would 7.6.1(11) imply that R.Component_1 and
R.Component_2 be finalized in the reverse order in which they were
initialized (in apparent contradiction to 7.6.1(9))?

                                -- thanks, Adam

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Order of subcomponent finalization
  1999-03-16  0:00 Order of subcomponent finalization adam
@ 1999-03-16  0:00 ` Tucker Taft
  0 siblings, 0 replies; 2+ messages in thread
From: Tucker Taft @ 1999-03-16  0:00 UTC (permalink / raw)


adam@irvine.com wrote:
> 
> Suppose a record type and an object of that type are declared:
> 
> procedure Subp is
> 
>     type Rectype is record
>         Component_1 : Controlled_Type_1;
>         Component_2 : Controlled_Type_2;
>     end record;
> 
>     R : Rectype;
> 
> begin
> ...
> end Subp;
> 
> where Controlled_Type_1 and Controlled_Type_2 are controlled types (duh).
> 
> According to 7.6(12), R.Component_1 and R.Component_2 are initialized
> in arbitrary order (since neither one has an access discriminant
> constrained by a per-object expression).  But does the RM specify in
> which order the components are finalized when Subp exits?  7.6.1(9)
> says similarly that the components of a composite type are finalized
> in arbitrary order; but 7.6.1(11) says that objects created by
> declarations in a master (in this case Subp) are finalized in the
> reverse order of their creation, and 3.3(12) says that R.Component_1
> and R.Component_2 are objects (although whether they count as "objects
> created by a declaration is unclear to me, especially after reading
> 3.3.1(16-19)).  So would 7.6.1(11) imply that R.Component_1 and
> R.Component_2 be finalized in the reverse order in which they were
> initialized (in apparent contradiction to 7.6.1(9))?

This is admittedly a bit unclear.  The intent is that
components can be finalized in any order, so long as they
don't have access to one another via access discriminants.

In the Annotated Ada RM, the "to-be-honest" given in 7.6.1(4.c)
indicates that only "top level" (non-component) objects are 
(directly) finalized as part of finalizing a master, while the 
subcomponents  are finalized as part of finalizing their enclosing 
object.

>                                 -- thanks, Adam

-- 
-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




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-03-16  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-16  0:00 Order of subcomponent finalization adam
1999-03-16  0:00 ` Tucker Taft

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