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,aa955fc1adc2b46d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!cyclone1.gnilink.net!gnilink.net!newsfeed3.dallas1.level3.net!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: of possible interest Date: 08 May 2006 20:41:41 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1146769504.421510.21010@j73g2000cwa.googlegroups.com> <8764klwpz5.fsf@ludovic-brenta.org> <87u082ouzs.fsf@ludovic-brenta.org> <0gcs52lejunc5qar09mf2mng2kg8kumedk@4ax.com> <20060507223701.175e2ec9@localhost.darkstar> <1147040746.9037.12.camel@localhost.localdomain> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: pcls4.std.com 1147135301 26507 192.74.137.71 (9 May 2006 00:41:41 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 9 May 2006 00:41:41 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news2.google.com comp.lang.ada:4163 Date: 2006-05-08T20:41:41-04:00 List-Id: Georg Bauhaus writes: > On Sun, 2006-05-07 at 22:37 +0200, Frederic Praca wrote: > > Le Sun, 07 May 2006 17:56:15 GMT, > > Dennis Lee Bieber a �crit : > > > > > On Sun, 07 May 2006 14:54:47 +0200, Ludovic Brenta > > > declaimed the following in comp.lang.ada: > > > > > > > > > > > - Java allows programmer to ignore the return value of functions. > > > > What if the return value was important? This is unsafe. > > > > > > > Off-hand -- this is a wash... Ada requires one to /account > > > for/ the presence of the return value, but it can still be just as > > > easily ignored... > > > > > > begin > > > dummy := some_function(some_argument); > > > -- dummy is never made use of; effectively > > > ignored end; > > Yes but in this case, everybody knows you explicitly ingore the > > return value, you didn't forget it by mistake. > > Does anyone know how relevant this is in practice, > given in mistakes per product, or increased development > cost? I doubt it. Such a scientific study would be pretty expensive. As usual, all we have is anecdotal evidence, plus some (nonscientific) reasoning, such as, "It seems to me more readable to have explicitly ignored results rather than implicitly ignored results". In languages that allow implicitly ignored results, programmers often write functions that return rarely-useful results, just because some result happens to be handy in the function body, knowing that the result can be easily ignored. For the above example, in Ada, one might write: function Some_Funtion(...) return Integer; procedure Some_Funtion(...); where they both do the same thing, but one returns a sometimes-useful result, and the other does not. The "dummy" thing above would be inside the procedure, rather than scattered all over the place. - Bob