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-Thread: 103376,e92d558e5b77fce2 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.213.68 with SMTP id nq4mr14602473pbc.2.1328634261934; Tue, 07 Feb 2012 09:04:21 -0800 (PST) Path: lh20ni271136pbb.0!nntp.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news-out.readnews.com!transit3.readnews.com!panix!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Building limited types through nested creator functions Date: Tue, 07 Feb 2012 12:04:21 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <40048c5a-ecf5-43e6-8c76-a294d0c333d1@l14g2000vbe.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1328634261 30977 192.74.137.71 (7 Feb 2012 17:04:21 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 7 Feb 2012 17:04:21 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:VzXwhx3RYtc8AmOOmE5Jyoo9+p4= Content-Type: text/plain; charset=us-ascii Date: 2012-02-07T12:04:21-05:00 List-Id: Simon Belmont writes: > Hi, > > Consider two limited record types, inner and outer, with the former > nested inside the latter. If the records are public, then code can > initialize the outer by specifying an aggregate for the inner, as in: > > type Inner is limited > record > e : Integer; > end record; > > type Outer is limited > record > i : Inner; > end record; > > o : Outer := Outer'(i => Inner'(e => 42)); > > However, if types are made private, suitable functions must be > provided to make the appropriate objects. I'm not sure exactly what you're trying to do, but maybe something like this would work: function Make_Outer(Make_Inner: not null access function return Inner) return Outer; You can pass "parameters" to the actual for Make_Inner by making it nested so it can see whatever it needs. - Bob