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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8e8cbb2b60aa0f38,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-11 01:11:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!enst.fr!not-for-mail From: "Grein, Christoph" Newsgroups: comp.lang.ada Subject: Re: Problems with 'class, help anyone? Date: Mon, 11 Nov 2002 10:03:59 +0100 (MET) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii X-Trace: avanie.enst.fr 1037005864 98737 137.194.161.2 (11 Nov 2002 09:11:04 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 11 Nov 2002 09:11:04 +0000 (UTC) Return-Path: X-Authentication-Warning: mail.eurocopter.com: uucp set sender to using -f Content-MD5: 9isdQz9tCpUW35aL4jLkYw== X-Mailer: dtmail 1.2.1 CDE Version 1.2.1 SunOS 5.6 sun4u sparc Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk X-Reply-To: "Grein, Christoph" List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:30710 Date: 2002-11-11T10:03:59+01:00 > There is another way, with perhaps even less incompatibility: let's introduce > third mode for a formal parameter - "return" mode (in addition to conventional > "in" and "out"). That "return" may be applied to the procedure's first parameter > only, and it means the same as "out" mode, with single exception: if the first > parameter of a procedure is in "return" mode then the procedure *may* be called > without the corresponding (first) argument, and in such a case it returns value. > For example: > > procedure Two_Fold(Result : return Boolean; Something : in Integer); > > X : Boolean; > Two_Fold(X, 0); -- "return" as "out", procedure does not return value > > if Two_Fold(0) then -- first argument omitted, procedure returns value > ... > end if; But an out parameter and a return value are not the same, i.e. they cannot generally be interchanged! Consider e.g. function F return String; vs. procedure P (S: out String); The former has no idea how long the object is that will get the result (if any), the latter takes the length from the parameter.