On Fri, 31 Aug 2012 06:22:35 -0400, Stephen Leake wrote:
> If we introduce the notion of "anonymous aggregates" (styled after
> "anonymous arrays"), we could do this:
>
> declare
> function Foo return
> (A : Integer;
> B : Float)
> is begin
> return
> (A => 1,
> B => 2.0);
> end Foo;
>
> (A : constant integer,
> B : constant Float) := Foo;
> begin
> ...
> end;
>
> I haven't thought much about how this would be implemented.
There are two separate issues here:
1. anonymous record types, one of the things I liked to have very much as
well as an ability to use anonymous arrays and aggregates as components.
The syntax is obvious:
function Foo return
record
A : Integer;
B : Float;
end record;
2. Usage of aggregates (of any kind) on the left side of assignment and in
out parameters. One could consider Ada 2012 aliased parameters somehow
extended on record components and array elements.
Another possible mechanism could be argument type conversion as in Ada 83
when a tuple (A, B) explicitly converted to a record as out parameter. This
roughly corresponds to your idea.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de