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 23:56:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: controlled initialization Date: 17 Dec 2002 07:55:35 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: <3DFD7B15.9050800@mbank.com.ua> <1040049195.294541@master.nyc.kbcfp.com> <1ec946d1.0212161526.7eb81067@posting.google.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1040111758 16821 62.49.19.209 (17 Dec 2002 07:55:58 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Tue, 17 Dec 2002 07:55:58 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:31944 Date: 2002-12-17T07:55:35+00:00 List-Id: Hyman Rosen writes: > Interesting. So (remembering that I don't know Ada) the following > would be illegal as well? If it is, is there a way to do what the > code obviously intends? Do I understand the issue correctly, that > is that MakeT could use O? > > package P is > type T is private; > O : constant T; > private > type T is new Controlled with null record; > function MakeT return T; > O : constant T := MakeT; > end P; One possibility is to make O a function (inlined if you need to). A related difficulty is where T is indefinite: from the under-work Booch Components, 1 type Unconstrained_Map 2 (Number_Of_Buckets : Positive) is new Abstract_Map with private; 3 4 subtype Map is Unconstrained_Map (Number_Of_Buckets => Buckets); 5 6 function Null_Container return Unconstrained_Map; 7 -- Note, this function has to be provided but the object returned 8 -- is in fact a Map (ie, it is constrained). Buckets in line 4 is a generic parameter, retained for consistency with previous releases, specifying the default number of hash buckets. Null_Container at line 6 is required because it's abstract in the parent. Still, folk relying on Null_Container can use it with the previous semantics.