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=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,57f8540942f8e060 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!b7g2000yqd.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Hibou57_=28Yannick_Duch=EAne=29?= Newsgroups: comp.lang.ada Subject: Re: Initialization and Finalization of limited object "returned" by a function Date: Thu, 11 Feb 2010 21:37:24 -0800 (PST) Organization: http://groups.google.com Message-ID: <8a8514af-0d80-4acc-a2de-d7128c345d97@b7g2000yqd.googlegroups.com> References: <75a9f860-ad3c-49a0-b2a1-a8f1386e6ff6@x10g2000prk.googlegroups.com> <2801be3a-afd6-4d14-ad7f-feb23a511f02@a5g2000yqi.googlegroups.com> NNTP-Posting-Host: 86.66.190.112 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1265953044 27673 127.0.0.1 (12 Feb 2010 05:37:24 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 12 Feb 2010 05:37:24 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b7g2000yqd.googlegroups.com; posting-host=86.66.190.112; posting-account=vrfdLAoAAAAauX_3XwyXEwXCWN3A1l8D User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; fr),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:9158 Date: 2010-02-11T21:37:24-08:00 List-Id: On 12 f=E9v, 00:08, Robert A Duff wrote: > Extended return statements are important in the limited case, > because you often want to say something like "Result.X :=3D ...;". > And as you discovered, aggregates aren't allowed for protected > or task types (which was probably a language design mistake). I agree with this in some way, as protected are largely handled like records. Further more, when you've made a syntactic while writing the declaration or the body of a protected, then GNAT, most of times points the error using the term "record" in the message (by the way, with respect to the way the language is defined, I feel this kind of message is not well suited, these may be disturbing for some users). On the other hand, why would someone want to initialize any thing in a protected ? The private part being only visible to the protected it- self, this would not make sense. Well, sure it would be useful to return a protected where a class-wide type is expected as the return result : the language requires an initialization here, thus the idea of an aggregate for protected and task in this purpose, in order to be able to initialize this class-wide type. But this should be an empty aggregate. What is needed, is not really an aggregate, but something to initialize an entity of class-wide type. Better than an aggregate for protected and task, there should be something acting like an empty aggregate, which would be to be used as an initializer for protected and task only.