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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Robert I. Eachus" Newsgroups: comp.lang.ada Subject: Re: limited agregate and limited components default initialization Date: Mon, 2 Apr 2018 18:39:05 -0400 Organization: Aioe.org NNTP Server Message-ID: References: <853b698c-204b-4a5e-a486-b2d7cb664b3a@googlegroups.com> NNTP-Posting-Host: fZYVf2g/avGnWJvs1xVPEA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 X-Notice: Filtered by postfilter v. 0.8.3 Content-Language: en-US Xref: reader02.eternal-september.org comp.lang.ada:51309 Date: 2018-04-02T18:39:05-04:00 List-Id: On 4/1/2018 7:36 PM, Jean-Claude Rostaing wrote: > Ok, now I know why what I wanted to do was impossible. To store an object into an accessor or whatever, or to create it with allocator, with only a given "value" of this limited type, you need to COPY this value, whatever you do. Which goes against the very idea of limited type. > I feel more intelligent thanks to that... > There is a messy but workable solution. Create (in the private part or package body) a non-limited type which has all the non-limited stuff from your limited type. Call it Foo. Now you can create an object of type Foo initialize it however you want, and then create the limited object with an aggregate containing Foo. Why messy? You have to add .Foo all over the place. But it works. (Of course if there are unconstrained limited components, you may be hosed.)