From: Shark8 <onewingedshark@gmail.com>
Subject: Question[s] about aliased extended return.
Date: Fri, 2 Nov 2012 08:55:49 -0700 (PDT)
Date: 2012-11-02T08:55:49-07:00 [thread overview]
Message-ID: <9bbd99bd-f953-434d-b3c8-6e8a6d5c7dfd@googlegroups.com> (raw)
The syntax for the extended return given in the RM [ http://www.ada-auth.org/standards/12rm/html/RM-6-5.html ] allows for the usage of the keyword ALIASED, with the restriction of "if the keyword aliased is present in an extended_return_object_declaration, the type of the extended return object shall be immutably limited."
The 2012 rationale entry regarding the extended return [ http://www.ada-auth.org/standards/12rat/html/Rat12-4-6.html ] says of immutably limited objects:
* 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 discriminant 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 allowed.
(2) Is there a reason this is not allowed? (Thick/thin 'pointer' differences?)
Lastly, the GNAT compiler seems to reject the following, even though the rationale says a "explicitly limited record type" qualifies as immutably limited:
Type LR is limited record
Data : Character:= 'X';
End record;
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?
next reply other threads:[~2012-11-02 15:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 15:55 Shark8 [this message]
2012-11-09 0:43 ` Question[s] about aliased extended return Randy Brukardt
2012-11-09 3:40 ` Yannick Duchêne (Hibou57)
2012-11-10 7:34 ` Randy Brukardt
2012-11-09 19:42 ` Shark8
2012-11-09 20:53 ` sbelmont700
2012-11-09 21:44 ` Yannick Duchêne (Hibou57)
2012-11-09 22:04 ` sbelmont700
2012-11-09 22:56 ` Shark8
2012-11-09 22:54 ` Shark8
2012-11-10 7:27 ` Randy Brukardt
2012-11-10 16:08 ` Shark8
2012-11-10 1:08 ` Jeffrey Carter
2012-11-10 1:52 ` Shark8
2012-11-10 2:17 ` Yannick Duchêne (Hibou57)
2012-11-10 10:59 ` Bill Findlay
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox