comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,)
Subject: Re: Collective response to := messages
Date: 4 Dec 88 23:27:17 GMT	[thread overview]
Message-ID: <3734@hubcap.UUCP> (raw)
In-Reply-To: 10960@ulysses.homer.nj.att.com

From article <10960@ulysses.homer.nj.att.com>, by dsr@hector.UUCP (David S. Rosenblum):
> |> They are not the least bit equivalent, for several reasons.  The most
> |> obvious reason is that an implementation is free to pass composite
> |> parameters by reference, although no implementation can "assign by
> |> reference". 
> |
> |    Sure, for "in out" mode.  But for modes "in" and "out", failure to
> |    use the ADT's assignment procedure causes major problems:
> |
> |      "out" mode:  Programmer assigns the parameter a value, and the
> |                   value is copied back to the actual parameter.  
> |                   Unfortunately, the portions of the actual parameter
> |                   which were formerly accessible by pointers are now
> |                   uncollectable garbage.
> |
> |       "in" mode:  Programmer assumes that this is a "pass by value"
> |                   and makes modifications.  Since ADT contains pointers,
> |                   modification echoes through to the actual parameter.
> |                   Programmer could also invoke DESTROY, blowing away
> |                   major portions of the actual parameter.
> 
> I'm terribly confused.  Are we still talking about Ada?  With this talk
> about parameter passing invoking source-level assignment, I'm not so sure.
> I'm not sure what your "out" mode comments refer to, but maybe you're
> confusing what access values (pointers) can point to in Ada, or maybe you're
> confusing how access values are passed as parameters in Ada--access values are
> ALWAYS copied IN to their respective places in formal parameters, EVEN for
> mode "out" formals.  

     OK.  Envision an ADT which just happens to be implemented as a pointer
     to a descriptor, which probably has more pointers to the "value".  Now
     our ADT user wishes to transfer an ADT "out".  The ADT user has no idea
     how the ADT is implemented.  Now when the procedure was invoked, let's 
     assume that the ADT supplied as an actual parameter had some value;
     hence, the pointer which represents the "ADT type" is not null, and 
     in fact constitutes the only known method for accessing a substantial
     amount of utilized memory.  Our ADT user sends the value "out", and
     Ada implements this by copying the value of a single pointer.  The old
     pointer value associated with the actual parameter is lost forever,
     and all the stuff it pointed to is now garbage.
 
> Your "in" mode comments are also vague.  First of all,
> "good" Ada programmers assume nothing about parameter passing behavior.

     Anything which is passed as an "in" parameter should be treatable as
     something which was passed in by value.  Anything which is passed as
     an "in out" parameter should be treatable as something which was passed
     by reference.  Anything which is passed as an "out" parameter should
     be treated as the target of a pass by value in the "outward" direction.

     If nothing can be assumed about parameter passing behavior, then 
     parameter passing is just too vaguely defined, and needs to be clarified.

> Second, an access value can be passed as a parameter, in which case the
> language is concerned only with the access value during parameter passing,
> NOT with the object designated by the access value.

     When what is being passed is known to the user as an access value,
     this is precisely what the programmer expects.  When what is being
     passed is known to the user as an ADT, this sort of behavior is
     totally counterintuitive.  It violates the abstraction.


                                          Bill Wolfe

                                  wtwolfe@hubcap.clemson.edu

  reply	other threads:[~1988-12-04 23:27 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-11-28 22:19 Collective response to := messages Geoff Mendal
1988-11-29 14:39 ` Dennis Doubleday
1988-11-29 21:08 ` Ray Trent
1988-11-30 14:37   ` Stephe Leake
1988-12-01 14:54     ` David S. Rosenblum
1988-12-02 20:21       ` William Thomas Wolfe,2847,
1988-12-04 21:15         ` David S. Rosenblum
1988-12-04 23:27           ` William Thomas Wolfe,2847, [this message]
1988-12-05 14:46             ` David S. Rosenblum
1988-12-05 21:23               ` William Thomas Wolfe,2847,
1988-12-07 17:33                 ` Stephe Leake
1988-12-07 16:03               ` Definition of pass by reference Robert Eachus
1988-12-07 17:15             ` Collective response to := messages Stephe Leake
1988-12-07 16:07       ` Stephe Leake
1988-12-09  3:15         ` David S. Rosenblum
1988-12-01 21:31     ` Ray Trent
1988-12-07 16:21       ` Stephe Leake
1988-11-30 16:29   ` David S. Rosenblum
1988-11-30 18:29     ` William Thomas Wolfe,2847,
1988-11-30 22:28       ` David S. Rosenblum
1988-12-01  3:09         ` William Thomas Wolfe,2847,
1988-12-01 15:16           ` David S. Rosenblum
1988-12-02 19:31             ` William Thomas Wolfe,2847,
1988-12-04 21:03               ` David S. Rosenblum
1988-12-05  2:34                 ` William Thomas Wolfe,2847,
1988-12-05 14:07                   ` David S. Rosenblum
1988-12-07 17:26                     ` Stephe Leake
1988-12-06 19:16                 ` Collective response to := messa stt
1988-12-09  3:39                   ` David S. Rosenblum
1988-11-30 19:13     ` CORRECTION Re: Collective response to := messages David S. Rosenblum
1988-12-01 18:31     ` Ray Trent
1988-12-02 14:49       ` David S. Rosenblum
1988-12-05 17:33         ` Collective response to := messa stt
1988-11-30 18:24   ` Collective response to := messages Robert Eachus
1988-12-02 14:58     ` David S. Rosenblum
1988-12-02 19:34   ` Mark C. Adolph
1988-12-05 17:15     ` Collective response to := messa stt
1988-11-29 21:44 ` Collective response to := messages William Thomas Wolfe,2847,
  -- strict thread matches above, loose matches on Subject: below --
1989-07-26 20:34 Memory Access Question tony
1989-07-27 13:06 ` richard a hammond
1989-07-27 18:53   ` Ray Trent
1989-07-28  0:48     ` Mike Murphy
1989-08-02 13:23       ` Mike Walsh
1989-08-02 20:20         ` Mike Murphy
1989-07-29  0:00 ` Brian Sullivan
1988-12-05  6:53 Collective response to := messages Erland Sommarskog
1988-12-03 22:53 Erland Sommarskog
1988-12-04 20:41 ` William Thomas Wolfe,2847,
1988-12-05  5:47   ` Richard A. O'Keefe
1988-12-05 12:45     ` William Thomas Wolfe,2847,
1988-12-06  1:54       ` Richard A. O'Keefe
1988-12-06 20:43         ` William Thomas Wolfe,2847,
1988-12-03 21:08 Erland Sommarskog
1988-12-04 20:30 ` William Thomas Wolfe,2847,
1988-11-14 13:20 Ada language revision Stanley Roger Allen, AdaDude
1988-11-15 23:28 ` Wilmer Rivers
1988-11-16 19:06   ` William Thomas Wolfe,2847,
1988-11-17 15:34     ` Stephe Leake
1988-11-18 16:39       ` Steve Tynor
1988-11-18 19:22       ` Ron Guilmette
1988-11-23 22:22       ` William Thomas Wolfe,2847,
1988-11-29 15:35         ` Stephe Leake
1988-11-18  0:32     ` Ron Guilmette
1988-11-22 14:37       ` Stephe Leake
1988-11-23 13:37         ` Dennis Doubleday
1988-11-23 19:41           ` Steve Tynor
1988-11-23 21:14             ` Richard Pattis
1988-11-25 20:36             ` Robert Firth
1988-11-29 15:12           ` limited private types Stephe Leake
1988-12-01 23:06             ` Ron Guilmette
1988-12-05  1:48               ` Paul Stachour
1988-12-05 12:31                 ` Reference Semantics William Thomas Wolfe,2847,
1988-12-06  0:29                   ` Paul Stachour
1988-12-07  1:07                     ` Reference Semantics, assignment overloading, etc Ray Trent
1988-12-08 17:36                       ` Reference Semantics, assignment ryer
1988-12-06 16:56               ` limited private types ryer
1988-12-06 20:09               ` stt
1988-12-07 15:51               ` Stephe Leake
1988-11-21 15:40   ` Ada language revision stt
replies disabled

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