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 X-Google-Thread: 103376,4180a73b05d119c7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-18 01:07:13 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!lnsnews.lns.cornell.edu!newsstand.cit.cornell.edu!ngpeer.news.aol.com!newsfeed1.bredband.com!bredband!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: ML-like alternatives to out parameters for functions Date: Tue, 18 Mar 2003 09:07:13 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: NNTP-Posting-Host: kiuk0152.chembio.ntnu.no Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: tyfon.itea.ntnu.no 1047978433 144 129.241.83.78 (18 Mar 2003 09:07:13 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Tue, 18 Mar 2003 09:07:13 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:35441 Date: 2003-03-18T09:07:13+00:00 List-Id: Mark Lorenzen wrote: > There has lately been some discussions about Ada's missing > capabilities for specifying out parameters for functions. Apparently > this is a needed feature and an AI (AI-323) has been issued. > > An out parameter can be used when the validity of the result of > evaluating a function is not always well-defined. For example: > > function Calculate (Argument : in AT; Result_Valid : out Boolean) return RT; > > > Use of the function could be as: > > Result := Calculate (Arg, Valid); > if Valid then > .. do stuff with Result .. > else > .. handle error .. > end if; Or you could do function Calculate (Argument : in AT; Result : out RT) return boolean; Use of the function could be as: if Calculate (Arg, Result) then .. do stuff with Result .. else .. handle error .. end if; -- �Don't use C; In my opinion, C is a library programming language not an app programming language.� - Owen Taylor (GTK+ developer) Use Ada 95, a free language. More info at http://www.adapower.com/