comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: anonymous aggregates?
Date: Fri, 31 Aug 2012 14:02:03 +0200
Date: 2012-08-31T14:02:03+02:00	[thread overview]
Message-ID: <14ea9dpbr6lnq$.jxp51rtuf0jp.dlg@40tude.net> (raw)
In-Reply-To: 85mx1bwec4.fsf@stephe-leake.org

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



  parent reply	other threads:[~2012-09-08  9:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-31 10:22 anonymous aggregates? Stephen Leake
2012-08-31 11:06 ` Brian Drummond
2012-08-31 12:02 ` Dmitry A. Kazakov [this message]
2012-08-31 15:15   ` Adam Beneschan
2012-08-31 22:37 ` Randy Brukardt
2012-08-31 22:57   ` Shark8
2012-09-01  9:57   ` Georg Bauhaus
2012-09-02 11:25     ` Stephen Leake
2012-09-02 12:34       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox