From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1e12d8e0da8e9a65 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-05 09:08:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.cwix.com!newscon01.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr12.news.prodigy.com.POSTED!not-for-mail From: "Pat Rogers" Newsgroups: comp.lang.ada References: <3C5FB880.6FD36A12@hotmail.com> Subject: Re: [HELP] Why is 'Adjust' not called here ??? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <3jU78.1282$h7.417153057@newssvr12.news.prodigy.com> NNTP-Posting-Host: 208.191.180.40 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr12.news.prodigy.com 1012928831 ST000 208.191.180.40 (Tue, 05 Feb 2002 12:07:11 EST) NNTP-Posting-Date: Tue, 05 Feb 2002 12:07:11 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: TSU[@I_AOXRQRILY@BJZ\_TDFRYB@GXLN@GZ_GYO^JWTEPIB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN Date: Tue, 05 Feb 2002 17:07:11 GMT Xref: archiver1.google.com comp.lang.ada:19642 Date: 2002-02-05T17:07:11+00:00 List-Id: "Stephen Leake" wrote in message news:uofj3ucng.fsf@gsfc.nasa.gov... > > "Didier Pieroux" 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).