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,faeb0c2550699cee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-16 15:26:03 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: mheaney@on2.com (Matthew Heaney) Newsgroups: comp.lang.ada Subject: Re: controlled initialization Date: 16 Dec 2002 15:26:02 -0800 Organization: http://groups.google.com/ Message-ID: <1ec946d1.0212161526.7eb81067@posting.google.com> References: <3DFD7B15.9050800@mbank.com.ua> <1040049195.294541@master.nyc.kbcfp.com> NNTP-Posting-Host: 66.162.65.162 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1040081163 22486 127.0.0.1 (16 Dec 2002 23:26:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Dec 2002 23:26:03 GMT Xref: archiver1.google.com comp.lang.ada:31925 Date: 2002-12-16T23:26:03+00:00 List-Id: Hyman Rosen wrote in message news:<1040049195.294541@master.nyc.kbcfp.com>... > > Ooh, ooh, I know, I know! I remember this from a thread > a while ago. Init isn't called for objects that are > initialized by aggregates. A rationale is that since > you are supplying all the fields in the aggregate, you > can just do whatever setup the Init proccedure would > have done. The real problem is when you're declaring a deferred constant, e.g. package P is type T is private; O : constant T; private type T is new Controlled with null record; procedure Initialize (O : in out T); O : constant T := (Controlled with null record); end P; The problem is that the body of P hasn't elaborated at the moment when object O is elaborated. Were Initialize to be called at the point of elaboration of O, then Program_Error would be raised because the body of Initialize hasn't been elaborated yet. So for aggregate initialization, Initialize doesn't get called, and all initialization is done in-place.