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,92d1af21ade61406 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-11 06:58:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!freenix!enst.fr!not-for-mail From: "Alexandre E. Kopilovitch" Newsgroups: comp.lang.ada Subject: Re: Problems with 'class, help anyone? Date: Mon, 11 Nov 2002 18:12:56 +0300 (MSK) 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 1037026682 99397 137.194.161.2 (11 Nov 2002 14:58:02 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Mon, 11 Nov 2002 14:58:02 +0000 (UTC) Return-Path: X-Mailer: Mail/@ [v2.44 MSDOS] 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 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 X-Original-Cc: christoph.grein@eurocopter.com Xref: archiver1.google.com comp.lang.ada:30727 Date: 2002-11-11T18:12:56+03: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. Well, I was not writing an AI (perhaps, I should?), therefore I did not look at the details. Surely, you are right - there must be a limitation for a parameter in "return" mode: if one is of indefinite type then the currently undefined attributes (Length, First, etc.) cannot be used for that parameter. Did you notice any other hole in that proposal? Alexander Kopilovitch aek@vib.usr.pu.ru Saint-Petersburg Russia