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.73.229 with SMTP id o5mr4737279pbv.7.1325870424511; Fri, 06 Jan 2012 09:20:24 -0800 (PST) Path: lh20ni145053pbb.0!nntp.google.com!news2.google.com!goblin1!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada2012 : Expression functions and extended return statements Date: Fri, 6 Jan 2012 18:20:12 +0100 Organization: cbb software GmbH Message-ID: <1292hrynqxgnm$.12shf160d3gpi.dlg@40tude.net> References: <94808f24-938b-476e-8912-f98b52982d53@j10g2000vbe.googlegroups.com> <1650969959347553100.869853martin-re.mo.ve.thedowies.com@news.btinternet.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: PPt+vSuBRqtkVsMLa1J3Dg.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-01-06T18:20:12+01:00 List-Id: On Fri, 06 Jan 2012 08:45:22 -0600, Martin Dowie wrote: > "Dmitry A. Kazakov" wrote: >> This is not a declaration, because the result is not an object. > > 2012 RM 3.1 6/3 says it is a declaration (but I should have written > 'Result' not 'Return'). Surely it says so, but it is not a declaration of the result object. When the result is copy-out, it is another object which value could become the value of the result object proper. Even for limited types it is still not necessarily the result object. In fact it is undecidable to figure out if it is: return X : Limited_T do if Halt (p) then raise I_Want_It_Otherwise; end if; ... end return; exception when I_Want_It_Otherwise => return Y : Limited_T do ... end return; Who is the result object, X or Y? The problem is that it is inherently inconsistent to have result objects declared within the function body. What Ada actually does is no different from a local variable, because there is no other way to return anything from a subprogram. Why bother introducing awful syntax, which does not mean what it is supposed to do? > The evolution of Ada has always resulted in adding things that aren't > "Ada-like" when compared to the previous revision. Alas. Return statement is certainly not. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de