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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!watmath!clyde!att!ulysses!hector!dsr From: dsr@hector.UUCP (David S. Rosenblum) Newsgroups: comp.lang.ada Subject: Re: Collective response to := messages Message-ID: <10960@ulysses.homer.nj.att.com> Date: 4 Dec 88 21:15:53 GMT References: <10917@ulysses.homer.nj.att.com> <3721@hubcap.UUCP> Sender: netnews@ulysses.homer.nj.att.com Reply-To: dsr@hector.UUCP (David S. Rosenblum) Organization: AT&T Bell Laboratories, Murray Hill, NJ List-Id: In article <3721@hubcap.UUCP> billwolf@hubcap.clemson.edu writes: |From article <10917@ulysses.homer.nj.att.com>, by dsr@hector.UUCP (David S. Rosenblum): |> In article <755@marvin.cme-durer.ARPA> leake@cme-durer.ARPA (Stephe Leake) writes: |>> |>>There seems to be a point of confusion concerning overloading of ":=". |>>Some people assume that the (overloaded) semantics of ":=" apply to |>>parameter passing. This seems to be a reasonable assumption, and I |>>think the current Ada parameter passing semantics are equivalent to |>>the current Ada assignment semantics. |> |> 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. Your "in" mode comments are also vague. First of all, "good" Ada programmers assume nothing about parameter passing behavior. 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. ------------------------------------------------------------------- David Rosenblum UUCP: {ucbvax, decvax}!ulysses!dsr AT&T Bell Laboratories ARPA: dsr@ulysses.att.com 600 Mountain Ave. dsr%ulysses@att.arpa Murray Hill, NJ 07974-2070 (201) 582-2906 -------------------------------------------------------------------