comp.lang.ada
 help / color / mirror / Atom feed
From: "Pat Rogers" <progers@classwide.com>
Subject: Re: [HELP] Why is 'Adjust' not called here ???
Date: Tue, 05 Feb 2002 17:07:11 GMT
Date: 2002-02-05T17:07:11+00:00	[thread overview]
Message-ID: <3jU78.1282$h7.417153057@newssvr12.news.prodigy.com> (raw)
In-Reply-To: uofj3ucng.fsf@gsfc.nasa.gov

"Stephen Leake" <stephen.a.leake.1@gsfc.nasa.gov> wrote in message
news:uofj3ucng.fsf@gsfc.nasa.gov...
> > "Didier Pieroux" <dpieroux@pi.be> wrote in message
> > news:3C5FB880.6FD36A12@hotmail.com...
> > > Hello,
> > >
> > > To make it short: why is 'Adjust' not called during initialization by a
> > > aggregate ?
>
> Because the RM says so :). Pat Rogers gave the RM references.
>
> I believe the rationale is that you can only do initialization by
> aggregate in the body of the package defining the type, so you are
> assumed to know what you are doing, and should do the equivalent of
> the Adjust processing while building the aggregate.
>
> Hmm, what I said about "body of the package" is strictly true only for
> limited controlled types. Still, if you have visibility so you can
> build an aggregate, you are presumed to know what you are doing.


The AARM gives the reason, though it is quite "pedestrian":

17.h.1/1 Reason: This is necessary to prevent elaboration problems with deferred
constants of controlled types. Consider:

package P is
   type Dyn_String is private;
   Null_String : constant Dyn_String;
   ...
private
   type Dyn_String is new Ada.Finalization.Controlled with ...
   procedure Finalize(X : in out Dyn_String);
   procedure Adjust(X : in out Dyn_String);

   Null_String : constant Dyn_String :=
      (Ada.Finalization.Controlled with ...);
   ...
end P;

17.h.3/1 When Null_String is elaborated, the bodies of Finalize and Adjust
clearly have not been elaborated. Without this rule, this declaration would
necessarily raise Program_Error (unless the permissions given below are used by
the compiler).






  reply	other threads:[~2002-02-05 17:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-05 10:48 [HELP] Why is 'Adjust' not called here ??? Didier Pieroux
2002-02-05 16:03 ` Pat Rogers
2002-02-05 16:16   ` Stephen Leake
2002-02-05 17:07     ` Pat Rogers [this message]
2002-02-06 10:01       ` [Thanks] " Didier Pieroux
2002-02-14 20:05 ` [HELP] " 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