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,e859f774bbb3dfb3 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: another way to shoot yourself in the foot? Date: Sun, 22 Jun 2008 16:44:08 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <54157920-377a-441b-9b0b-f0c4f9ddffec@f36g2000hsa.googlegroups.com> <54435596-5e7f-4686-a2b7-1e22d7c4b186@p25g2000hsf.googlegroups.com> <483ugmvkl2ea.1hrqsq7ru4t1x$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1214167448 10963 192.74.137.71 (22 Jun 2008 20:44:08 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 22 Jun 2008 20:44:08 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:4GM4EWKmkRiRRirlwc6lsLKQF8E= Xref: g2news1.google.com comp.lang.ada:807 Date: 2008-06-22T16:44:08-04:00 List-Id: "Dmitry A. Kazakov" writes: > One problem with your proposal is: > > function Foo (...) return String is > begin > declare > Result : return String (1..200); -- Going to return 200 characters > begin > Result (1) := 'a'; -- Here the result has to be allocated > if HALT (x) then > return; -- Return from Foo with Result > end if; > end; -- Drop already allocated and initialized result > return "Hallo!"; -- Return a completely different thing > end Foo; I don't see that as a problem, and anyway, the same thing can happen with the existing syntax: function Foo (...) return String is begin return Result : String (1..200) do -- Going to return 200 characters Result (1) := 'a'; -- Here the result has to be allocated if HALT (x) then goto Label; end if; end; -- Drop already allocated and initialized result <