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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: limited agregate and limited components default initialization Date: Tue, 3 Apr 2018 21:18:54 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <3a9d9cbf-87aa-41a4-89b5-b4a02ebcb748@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 3 Apr 2018 19:18:54 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="6294fd639b54ae015ad3af8cd51aef87"; logging-data="30624"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18UCr8psL2vltKEWDAYTZT4whC15z8u+/o=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 In-Reply-To: <3a9d9cbf-87aa-41a4-89b5-b4a02ebcb748@googlegroups.com> Content-Language: en-US Cancel-Lock: sha1:Xo+dgDtRg83Z/umkGBAlAt6vPzU= Xref: reader02.eternal-september.org comp.lang.ada:51322 Date: 2018-04-03T21:18:54+02:00 List-Id: On 04/03/2018 08:18 PM, Jean-Claude Rostaing wrote: > > p.adb:5:10: prefix of protected procedure or entry call must be variable Obj should be mode "in out". > p.adb:9:14: invalid prefix in call I can't say I've ever tried to have a function return a protected type. I think you'll need to do begin return R : Essai (D1 => V); end Essai; But I think it would be better in this case to expose the discriminant: type Essai (D1 : Natural) is limited private; Then clients have to provide the value they would pass to Constructor as the discriminant: E : Essai (D1 => V); which does what you want and is simpler. -- Jeff Carter "[A] brilliant military career that after thirty years catapulted him to the rank of corporal." Take the Money and Run 138