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: 103376,cced0e2ac94722f3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.2 with SMTP id gm2mr3755886pbc.4.1325843324540; Fri, 06 Jan 2012 01:48:44 -0800 (PST) Path: lh20ni141619pbb.0!nntp.google.com!news1.google.com!feed-C.news.volia.net!volia.net!news2.volia.net!feed-A.news.volia.net!news.musoftware.de!wum.musoftware.de!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.uni-weimar.de!not-for-mail From: stefan-lucks@see-the.signature Newsgroups: comp.lang.ada Subject: Re: Ada2012 : Expression functions and extended return statements Date: Fri, 6 Jan 2012 10:45:12 +0100 Organization: Bauhaus-Universitaet Weimar Message-ID: References: <26f343ea-d694-4089-b594-f32b471db3a4@m4g2000vbc.googlegroups.com> Reply-To: stefan-lucks@see-the.signature NNTP-Posting-Host: medsec1.medien.uni-weimar.de Mime-Version: 1.0 X-Trace: tigger.scc.uni-weimar.de 1325843264 6583 141.54.178.228 (6 Jan 2012 09:47:44 GMT) X-Complaints-To: news@tigger.scc.uni-weimar.de NNTP-Posting-Date: Fri, 6 Jan 2012 09:47:44 +0000 (UTC) X-X-Sender: lucks@medsec1.medien.uni-weimar.de In-Reply-To: <26f343ea-d694-4089-b594-f32b471db3a4@m4g2000vbc.googlegroups.com> Content-Type: TEXT/PLAIN; charset=US-ASCII Date: 2012-01-06T10:45:12+01:00 List-Id: On Fri, 6 Jan 2012, Martin wrote: > Also, on the topic of extended return statements... > > What's the rational for having to explicitly repeat the return type? > Seems rather redundant to my eyes. I wouldn't have minded: I guess, this is because the object actually returned may not necessarily be of exactly the same type of subtype as the declared return type -- like the ordinary return statement. See the following examples: function Characters(I: Integer; Filler: Character := '_') return String is begin return Result: String(1..I) := (others => Filler) do return; end return; end Characters; type T is tagged record I: Integer; end record; type S is new T with record J: Natural; end record; function Fun(N, M: Natural) return T'Class is begin return Result: S do Result.I := M; Result.J := N; end return; end Fun; -- ---- Stefan.Lucks (at) uni-weimar.de, University of Weimar, Germany ---- ------ I love the taste of Cryptanalysis in the morning! ------