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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,5ebeef2944e4167d X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.74.10 with SMTP id p10mr1751730pav.17.1347096385865; Sat, 08 Sep 2012 02:26:25 -0700 (PDT) Path: t10ni18510623pbh.0!nntp.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!ctu-peer!news.nctu.edu.tw!csnews.cs.nctu.edu.tw!news.cs.nctu.edu.tw!feeder.erje.net!news2.arglkargh.de!news.ecp.fr!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: anonymous aggregates? Date: Fri, 31 Aug 2012 14:02:03 +0200 Organization: cbb software GmbH Message-ID: <14ea9dpbr6lnq$.jxp51rtuf0jp.dlg@40tude.net> References: <85mx1bwec4.fsf@stephe-leake.org> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-08-31T14:02:03+02:00 List-Id: 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