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,FREEMAIL_FROM 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,UTF8 Received: by 10.68.226.10 with SMTP id ro10mr3778734pbc.6.1328052005670; Tue, 31 Jan 2012 15:20:05 -0800 (PST) Path: lh20ni246432pbb.0!nntp.google.com!news1.google.com!goblin1!goblin.stu.neva.ru!news.tornevall.net!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Ada2012 : Expression functions and extended return statements Date: Wed, 01 Feb 2012 00:20:02 +0100 Organization: Ada @ Home Message-ID: References: <26f343ea-d694-4089-b594-f32b471db3a4@m4g2000vbc.googlegroups.com> NNTP-Posting-Host: ORlngJW8mt48EkB5K/HOIA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.61 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable Date: 2012-02-01T00:20:02+01:00 List-Id: Le Fri, 06 Jan 2012 09:45:26 +0100, Martin a =C3=A9= crit: > Am I correct in thinking these 2 parts of the language can't be > 'mixed'?... > > There doesn't seem to be anything that allows anything like, e.g. > > package Foo is > type T (<>) is tagged private; > function Create return T is > (Result : T do Result.I :=3D 1); > private > type T is tagged record > I : Integer; > end record; > end Foo; Private stuff in the public part is funny, don't you think ? > 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: At least because Ada does not have Type Inference. You have to declare t= he = returned entity, just like you would do with a classic return=E2=80=91by= =E2=80=91copy (*). = You have to build something in=E2=80=91place, so have to declare what yo= u build, = even if it's not tagged and class=E2=80=91wide. Sorry, can't see better words to explain. (*) Example: function F return String is Result : String; begin Result :=3D "...."; P (Result); -- in/out Result -- Etc. return Result; end F; -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [1] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [1] [1]: Epigrams on Programming =E2=80=94 Alan J. =E2=80=94 P. Yale Univers= ity