comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Parameter Modes, In In Out and Out
Date: Sat, 06 Jan 2001 20:31:35 GMT
Date: 2001-01-06T20:31:35+00:00	[thread overview]
Message-ID: <937vb7$55s$1@nnrp1.deja.com> (raw)
In-Reply-To: UFK56.92519$A06.3377688@news1.frmt1.sfba.home.com

In article <UFK56.92519$A06.3377688@news1.frmt1.sfba.home.com>,
  tmoran@acm.org wrote:
> >>> An out parameter is still taken in.
> >>     No, actually, it is not.
> >This is false information.
>   Robert is technically correct about that sentence.  As
noted in the
> unquoted part of my post, by-reference is an exception.  Ada
is a
> language meant to be read by humans, not just compilers,
however.
> Though it may be obvious to a compiler, or a compiler writer,
that a
> particular OUT parameter can be treated as IN OUT, it may be
> confusing to a human reader, and thus should not be done.


This is quite a confusing followup. A by-reference type is NOT
the same thing as a parameter that happens to be passed by
reference (Tom mentioned large arrays, but that has nothing
whatever to do with by-reference types).

A by-reference type is one that is *REQUIRED* to be passed
by reference. A program may definitely RELY on such a parameter
being passed by reference, and it is not flaky, or undesirable,
or bad practice, to rely on this, since it is guaranteed by the
language.

For such types, IN OUT is identical to OUT semantically (this
is NOT the case with large arrays that happen to be passed by
reference).

Tom in his earlier post said

 >>> An out parameter is still taken in.
> >>     No, actually, it is not.

And it is the reply here that I was saying is quite wrong. The
out parameter *IS* "taken in" for a by-reference type and there
is nothing wrong with relying on this (in fact it is quite
common to read at least some part of out parameters, e.g. array
bounds, and this was allowed even in Ada 83).

So this is not a matter of being technically correct, it is an
important part of the language semantics, and should be
properly understood!

Yes, purely as a stylistic matter one may prefer to use OUT to
indicate that the program does not read anything important from
the parameter, where anything important is not necessarily well
defined (for example, it is perfectly normal for a program to
access the tag of an OUT parameter -- and yes, I know, the tag
is not part of the value :-). But that's all this is, a purely
stylistic issue.

In other situations with by-copy types that are not access
types, it is plain wrong (a bounded error) to read an OUT
parameter, so it is really important to understand the
distinction here, and not sweep it under the carpet of
stylistic rules :-)


Sent via Deja.com
http://www.deja.com/



  reply	other threads:[~2001-01-06 20:31 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-06  0:11 Parameter Modes, In In Out and Out i.a.mcleod
2001-01-06  4:58 ` tmoran
2001-01-06 17:06   ` Robert Dewar
2001-01-06 19:50     ` tmoran
2001-01-06 20:31       ` Robert Dewar [this message]
2001-01-07  1:59     ` John English
2001-01-07  3:51       ` Robert Dewar
2001-01-08 12:06         ` dmitry6243
2001-01-09  4:32           ` Robert Dewar
2001-01-09 10:05             ` dmitry6243
2001-01-09  4:35           ` Robert Dewar
2001-01-09  9:58             ` dmitry6243
2001-01-09 14:13               ` Robert Dewar
2001-01-09 18:29                 ` dmitry6243
2001-01-09 19:55                   ` Robert Dewar
2001-01-10  0:47                     ` Brian Rogoff
2001-01-10 21:50                       ` Robert Dewar
2001-01-10  9:23                     ` dmitry6243
2001-01-10 21:46                       ` Robert Dewar
2001-01-11 11:46                         ` dmitry6243
2001-01-11 16:48                           ` Robert Dewar
2001-01-11 19:52                             ` Thierry Lelegard
2001-01-11 20:10                               ` Pascal Obry
2001-01-12  8:05                                 ` Florian Weimer
2001-01-12 13:31                               ` gasperon
2001-01-12 14:02                                 ` n_brunot
2001-01-12 17:26                                   ` charlet
2001-01-14 18:23                                     ` n_brunot
2001-01-14 21:05                                       ` Robert Dewar
2001-01-15  8:56                                         ` n_brunot
2001-01-12 11:05                             ` dmitry6243
2001-01-12 13:55                               ` Robert Dewar
2001-01-12 22:10                                 ` Dale Stanbrough
2001-01-13  1:13                                   ` Robert Dewar
2001-01-13 17:29                                 ` dmitry6243
2001-01-13 18:22                                   ` Robert Dewar
2001-01-13 22:32                                     ` Brian Rogoff
2001-01-14  6:02                                       ` Jeffrey Carter
2001-01-14 14:33                                         ` Robert Dewar
2001-01-14 18:14                                           ` Jeffrey Carter
2001-01-14 21:10                                             ` Robert Dewar
2001-01-14 20:45                                         ` Brian Rogoff
2001-01-14 14:23                                       ` Robert Dewar
2001-01-14 20:42                                         ` Brian Rogoff
2001-01-14 21:17                                           ` Robert Dewar
2001-01-15 20:57                                             ` Brian Rogoff
2001-01-15 16:25                                     ` dmitry6243
2001-02-02  7:06                                       ` Multiple dispatch (was " mark_lundquist
2001-02-02 13:49                                         ` dmitry6243
2001-01-16 12:22                                 ` Georg Bauhaus
2001-01-13  4:46                           ` Larry Kilgallen
     [not found]                           ` <93ko49$auq$1@nnrp1.deja.coOrganization: LJK Software <eiviJtYj+A7W@eisner.decus.org>
2001-01-13  6:00                             ` Robert Dewar
2001-01-11 21:38               ` mark_lundquist
2001-01-12  0:20                 ` John English
2001-01-12 13:57                   ` Robert Dewar
2001-01-12 20:34                     ` mark_lundquist
2001-01-13 18:06                       ` Brian Rogoff
2001-01-11 21:28             ` mark_lundquist
2001-01-12 12:35               ` dmitry6243
2001-01-12 21:22                 ` mark_lundquist
2001-01-13  1:16                   ` Robert Dewar
2001-02-02  5:42                     ` mark_lundquist
2001-02-02 14:55                       ` Stephen Leake
2001-02-02 20:08                         ` Robert Dewar
2001-02-05 15:00                           ` Stephen Leake
2001-01-13 21:26               ` Jean-Pierre Rosen
2001-01-11 21:24           ` mark_lundquist
2001-01-12 12:13             ` dmitry6243
2001-01-06 16:21 ` Jean-Pierre Rosen
2001-01-09 15:15   ` Thierry Lelegard
2001-01-10 21:53     ` Robert Dewar
2001-01-07 19:15 ` DuckE
2001-01-09 20:44 ` Laurent Guerby
2001-01-09 21:46   ` Florian Weimer
2001-01-10 21:57   ` Robert Dewar
2001-01-10 23:51     ` Tucker Taft
2001-01-11  4:23       ` Robert Dewar
2001-01-11 19:28     ` Laurent Guerby
2001-01-18 18:53 ` FAROOQATIF
replies disabled

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