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.212.98 with SMTP id nj2mr4646831pbc.8.1325868021797; Fri, 06 Jan 2012 08:40:21 -0800 (PST) Path: lh20ni144733pbb.0!nntp.google.com!news2.google.com!postnews.google.com!f1g2000yqi.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:38:49 -0800 (PST) Organization: http://groups.google.com Message-ID: <02c279d0-7603-4670-af1a-cbf5894231ea@f1g2000yqi.googlegroups.com> References: <26f343ea-d694-4089-b594-f32b471db3a4@m4g2000vbc.googlegroups.com> <9d181c23-2d64-4947-a6f7-64e0dcda357b@f11g2000yql.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 X-Trace: posting.google.com 1325868018 1777 127.0.0.1 (6 Jan 2012 16:40:18 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 6 Jan 2012 16:40:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f1g2000yqi.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:38:49-08:00 List-Id: On Jan 6, 8:33=A0am, Adam Beneschan wrote: > 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. =A0If Some_Type is a class-wide type, Result's type must be > a specific type. =A0If Some_Type is, say, an unconstrained array type, > Result's type must be a constrained subtype. Oops, I goofed. Result's type doesn't *have* to be a specific, constrained subtype, if there is an initial value (which could be a function call, say); the specific type and subtype are then determined from the value. If there is no initial value, however, then Result's type does have to be constrained. -- Adam