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=-1.9 required=5.0 tests=BAYES_00,LOTS_OF_MONEY autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,75a8a3664688f227 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-06 18:19:51 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!newspump.monmouth.com!newspeer.monmouth.com!news.maxwell.syr.edu!newspeer.clara.net!news.clara.net!news.vas-net.net!server2.netnews.ja.net!newshost.central.susx.ac.uk!news.bton.ac.uk!not-for-mail From: John English Newsgroups: comp.lang.ada Subject: Re: Parameter Modes, In In Out and Out Date: Sun, 07 Jan 2001 01:59:27 +0000 Organization: University of Brighton Message-ID: <3A57CD7F.2228BFD5@brighton.ac.uk> References: <7Cx56.90736$A06.3322588@news1.frmt1.sfba.home.com> <937jab$s23$1@nnrp1.deja.com> NNTP-Posting-Host: dialin-b1.bton.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: saturn.bton.ac.uk 978832342 23461 194.81.199.181 (7 Jan 2001 01:52:22 GMT) X-Complaints-To: news@bton.ac.uk NNTP-Posting-Date: 7 Jan 2001 01:52:22 GMT X-Mailer: Mozilla 4.6 [en] (Win95; I) X-Accept-Language: en,pdf Xref: supernews.google.com comp.lang.ada:3733 Date: 2001-01-07T01:52:22+00:00 List-Id: Robert Dewar wrote: > > In article <7Cx56.90736$A06.3322588@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. In many instances, outlined clearly > in the RM, the questioner is right, an IN OUT parameter and > an OUT parameter are identical. Ouch. The implication of this statement, read loosely, is that "out" parameters are redundant and can be replaced by "in out" parameters. It may be strictly false information, but I think it's more confusing to assert that "out" means the same as "in out" (since many readers will forget to factor in the leading "in many instances" and will get lost in a maze of twisty little grammar rules, all alike). I prefer to consider parameter passing by copy-and-return rather than by-reference as the norm (even though it applies to fewer situations in practice): "out" parameters are initially uninitialised (if that makes sense to you ;-) and the final value is copied out on return from the procedure, whereas "in out" parameters are copied in on entry and so are guaranteed to have valid initial values. Side effects due to aliasing complicate this (you then have to know which types are passed by reference and which aren't) but I think that assuming by-reference parameter passing as the default makes understanding what's going on (as in this question of "out" vs. "in out") more complicated, not less; in the absence of side effects, copy-in-and-out is equivalent to by-reference and distingusiahes clearly between the various cases. And anyone who uses aliasing for side effects deserves to sow what they reap, IMHO... ;-) YMMV, especially if your name is "Robert"; language lawyers and language users are different audiences for such debates IMHO ;-) ----------------------------------------------------------------- John English | mailto:je@brighton.ac.uk Senior Lecturer | http://www.comp.it.bton.ac.uk/je Dept. of Computing | ** NON-PROFIT CD FOR CS STUDENTS ** University of Brighton | -- see http://burks.bton.ac.uk -----------------------------------------------------------------