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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e51f94f876618e37,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.197.201 with SMTP id iw9mr948611pbc.6.1351871749910; Fri, 02 Nov 2012 08:55:49 -0700 (PDT) Received: by 10.68.135.67 with SMTP id pq3mr497986pbb.19.1351871749894; Fri, 02 Nov 2012 08:55:49 -0700 (PDT) Path: s9ni74817pbb.0!nntp.google.com!kr7no29366763pbb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 2 Nov 2012 08:55:49 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.20.190.126; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 69.20.190.126 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9bbd99bd-f953-434d-b3c8-6e8a6d5c7dfd@googlegroups.com> Subject: Question[s] about aliased extended return. From: Shark8 Injection-Date: Fri, 02 Nov 2012 15:55:49 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-11-02T08:55:49-07:00 List-Id: The syntax for the extended return given in the RM [ http://www.ada-auth.or= g/standards/12rm/html/RM-6-5.html ] allows for the usage of the keyword ALI= ASED, with the restriction of "if the keyword aliased is present in an exte= nded_return_object_declaration, the type of the extended return object shal= l be immutably limited." The 2012 rationale entry regarding the extended return [ http://www.ada-aut= h.org/standards/12rat/html/Rat12-4-6.html ] says of immutably limited objec= ts: * it is an explicitly limited record type, * it is a task type, protected type or synchronized interface, * it is a non-formal limited private type that is tagged or has an access d= iscriminant with a default expression, [or] * it is derived from an immutably limited type. (1) Doesn't this reduce the usefulness of the extended return? There are a couple of times building the OpenGL binding where I would have = liked to do something like: Function some_vector( [params] ) Return Vector_of_points is begin Return Result : access Vector_of_points( 1..size_from_params ) do glFunctionPopulatingVector( glEnum_from_params, Result'access ) end return; end some_vector; in order to populate the vector with the requisite data, but this is not al= lowed. (2) Is there a reason this is not allowed? (Thick/thin 'pointer' difference= s?) Lastly, the GNAT compiler seems to reject the following, even though the ra= tionale says a "explicitly limited record type" qualifies as immutably limi= ted: Type LR is limited record Data : Character:=3D 'X'; End record; =20 Function Get_LR Return LR is begin Return Result : aliased LR do null; end return; end Get_LR; (3) Is this a bug, or am I just misreading everything?