comp.lang.ada
 help / color / mirror / Atom feed
From: Richard Riehle <richard@adaworks.com>
Subject: Re: Ada style of passing 'in' parameters considered dangerous?
Date: Tue, 11 Feb 2003 17:09:24 -0800
Date: 2003-02-12T00:59:27+00:00	[thread overview]
Message-ID: <3E499EC4.4D341E02@adaworks.com> (raw)
In-Reply-To: 17cd177c.0302110114.2c46b52@posting.google.com

Gautier wrote:

> I'd suggest that compilers issue a warning when the following
> conditions meet:
>  - there are parameters of the same type, some IN, some [IN] OUT
>  - the compiler decides to pass the IN by reference
>  - an IN parameter is referenced after an IN OUT was modified
> and also:
>  - for a call, when the same variable is passed to an IN
>    by reference and an [IN] OUT (it doesn't solve the issue of
>    ".all" objects!).

There is an interesting, but seldom engaged, principle that any method
that modifies an object should do only modification, and any method
that queries an object should do only queries.

This is difficult in Ada because it does not use the distiguished
received model.  Therefore,  we are often forced to use modes
of in out  or have a combination of parameters for in and out
on the same data type.  For limited types, in out is often the
only alternative.   Therefore, the notion of issuing a warning
might serve quite nicely to alert a programmer to a potential
problem.

Richard Riehle




      parent reply	other threads:[~2003-02-12  1:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-08 22:24 Ada style of passing 'in' parameters considered dangerous? Antti Sykari
2003-02-09  0:41 ` James S. Rogers
2003-02-09  2:11   ` Robert A Duff
2003-02-09  2:25   ` Jeffrey Carter
2003-02-11  8:39   ` Gautier
2003-02-09  2:01 ` Robert A Duff
2003-02-09  2:33   ` Vinzent Hoefler
2003-02-09  6:07   ` Richard Riehle
2003-02-09  7:13   ` Robert I. Eachus
2003-02-10  4:40     ` Martin Dowie
2003-02-09  2:08 ` Jeffrey Carter
2003-02-10  0:13 ` Leif Holmgren
2003-02-10  9:49 ` Rod Chapman
2003-02-11  9:14 ` Gautier
2003-02-11 13:49   ` Antti Sykari
2003-02-11 17:18   ` Gautier
2003-02-11 17:29     ` Vinzent Hoefler
2003-02-12  1:09   ` Richard Riehle [this message]
replies disabled

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