comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: of possible interest
Date: 08 May 2006 20:41:41 -0400
Date: 2006-05-08T20:41:41-04:00	[thread overview]
Message-ID: <wccpsioqbay.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 1147040746.9037.12.camel@localhost.localdomain

Georg Bauhaus <bauhaus@futureapps.de> 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 <wlfraed@ix.netcom.com> a �crit :
> > 
> > > On Sun, 07 May 2006 14:54:47 +0200, Ludovic Brenta
> > > <ludovic@ludovic-brenta.org> 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



  parent reply	other threads:[~2006-05-09  0:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-04 19:05 of possible interest Marco
2006-05-04 19:26 ` Ludovic Brenta
2006-05-04 23:30   ` Georg Bauhaus
2006-05-05  2:49     ` Ed Falis
2006-05-05 14:40     ` Ludovic Brenta
2006-05-07  7:46   ` Nasser Abbasi
2006-05-07 11:50     ` Larry Kilgallen
2006-05-07 12:54     ` Ludovic Brenta
     [not found]       ` <0gcs52lejunc5qar09mf2mng2kg8kumedk@4ax.com>
2006-05-07 20:37         ` Frederic Praca
2006-05-07 22:25           ` Georg Bauhaus
2006-05-08  7:26             ` Ludovic Brenta
2006-05-09  0:41             ` Robert A Duff [this message]
2006-05-11 22:25               ` David Emery
2006-05-12 15:45                 ` Pascal Obry
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox