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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham 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 Received: by 10.68.117.197 with SMTP id kg5mr1847066pbb.5.1325867697288; Fri, 06 Jan 2012 08:34:57 -0800 (PST) Path: lh20ni144684pbb.0!nntp.google.com!news1.google.com!postnews.google.com!f11g2000yql.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Ada2012 : Expression functions and extended return statements Date: Fri, 6 Jan 2012 08:33:38 -0800 (PST) Organization: http://groups.google.com Message-ID: <9d181c23-2d64-4947-a6f7-64e0dcda357b@f11g2000yql.googlegroups.com> References: <26f343ea-d694-4089-b594-f32b471db3a4@m4g2000vbc.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1325867618 30622 127.0.0.1 (6 Jan 2012 16:33:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 Jan 2012 16:33:38 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f11g2000yql.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: ARLUEHNKC X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2012-01-06T08:33:38-08:00 List-Id: On Jan 6, 12:45=A0am, 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: > > function Bar return Some_Type is > begin > =A0 =A0return Result : <> do > =A0 =A0 =A0 -- something to initialise 'Result' > =A0 =A0end return; > end Bar; > > or even > > function Bar return Some_Type is > begin > =A0 =A0return Result do > =A0 =A0 =A0 -- something to initialise 'Result' > =A0 =A0end return; > end Bar; > > In this case, 'Result' can't be anything other than of type > 'Some_Type' can it? Yes, it can. If Some_Type is a class-wide type, Result's type must be a specific type. If Some_Type is, say, an unconstrained array type, Result's type must be a constrained subtype. -- Adam