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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,9245b8db9abd376c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-16 03:05:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!tar-alcarin.cbb-automation.DE!not-for-mail From: Dmitry A. Kazakov Newsgroups: comp.lang.ada Subject: Re: Out parameters in a function Date: Tue, 16 Apr 2002 12:05:01 +0200 Message-ID: References: <4519e058.0204150709.55c94dfb@posting.google.com> <3cbbe583.3628858@news.demon.co.uk> NNTP-Posting-Host: tar-alcarin.cbb-automation.de (212.79.194.111) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: fu-berlin.de 1018951501 3171498 212.79.194.111 (16 [77047]) X-Newsreader: Forte Agent 1.8/32.548 Xref: archiver1.google.com comp.lang.ada:22594 Date: 2002-04-16T12:05:01+02:00 List-Id: On Tue, 16 Apr 2002 08:49:44 GMT, john.mccabe@emrad.ns.com (John McCabe) wrote: >On 15 Apr 2002 08:09:24 -0700, dennison@telepath.com (Ted Dennison) >wrote: > >>"Nazgul" wrote in message news:... >>> function ReadChar(f: File; c: out character) return boolean; >>> >>> The function must return a boolean, so the only way to read the character is >>> via the 'c' parameter. In other context, I use >>... >>> Is there any way of using c as an output parameter? >> >>No. In Ada functions take multiple "in" parameters, and return only >>one value via the "return" machanisim. If you have multiple values you >>need to return, you should be using a procedure, not a function. > >Unfortunate that they didn't follow the Occam example of having a >function capable of returning multiple values! Let they do. I.e. let a function return an object of anonymous record type which components are returned values: function Match_Pattern (..) return record Place : Position; Matched : String; end record; How could we use such object? It does not well fit in a language with named parameter association and very limited possibilities of matching types by structure. IMO out parameters make more sense. --- Regards, Dmitry Kazakov www.dmitry-kazakov.de