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,LOTS_OF_MONEY, MSGID_RANDY autolearn=no 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 12:45:52 PST Path: supernews.google.com!sn-xit-02!supernews.com!216.218.236.179.MISMATCH!news!news.he.net!news-peer.gip.net!news.gsl.net!gip.net!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: Robert Dewar Newsgroups: comp.lang.ada Subject: Re: Parameter Modes, In In Out and Out Date: Sat, 06 Jan 2001 20:31:35 GMT Organization: Deja.com Message-ID: <937vb7$55s$1@nnrp1.deja.com> References: <937jab$s23$1@nnrp1.deja.com> NNTP-Posting-Host: 205.232.38.14 X-Article-Creation-Date: Sat Jan 06 20:31:35 2001 GMT X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; U) X-Http-Proxy: 1.0 x52.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 X-MyDeja-Info: XMYDJUIDrobert_dewar Xref: supernews.google.com comp.lang.ada:3717 Date: 2001-01-06T20:31:35+00:00 List-Id: In article , 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/