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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Ada 2012: In-out parameters for functions Date: Thu, 2 May 2013 08:41:41 +0200 Organization: cbb software GmbH Message-ID: References: <7704abab-86f2-4edc-ad4b-b3d4e70004fb@googlegroups.com> <16vvwvhsw7qit.dwhm4k8m5ggs$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 15waz9CoS+eMakbyhTPyFQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2863 Xref: number.nntp.dca.giganews.com comp.lang.ada:181355 Date: 2013-05-02T08:41:41+02:00 List-Id: On Wed, 01 May 2013 21:58:36 +0200, Yannick Duchêne (Hibou57) wrote: > Le Wed, 01 May 2013 21:37:43 +0200, Dmitry A. Kazakov > a écrit: > >> On Wed, 01 May 2013 21:04:03 +0200, Yannick Duchêne (Hibou57) wrote: >> >>> In/out (both way) parameters may be another story, and may more suggest >>> this is a procedure and not a function, >> >> function Read (Stream : in out Root_Stream_Type) return String; > > :D > > This is more a procedure than a function (it either won't return the same > the next time invoked with the same argument or either the argument can > never be considered to be the same as it use to be any‑more), Surely it will. Same argument means same value and the value of a stream is its state. If the stream is in the same state the function will return same result. > and a > function construct is used only because it is preferable to return an > unconstrained type Not only. Functions are used when there is a dedicated result/effect which is used as an input for another routine or language construct. > That's a good example of how a construct may not always match the intended > semantic; The semantics [in the context of program design] of a function and procedure are exactly same, it is called "subroutine." > I feel `function` and `procedure` in Ada means something at the > implementation level more than at the intention level, even if many times > both matches as gloves and hands. Ada 83 confused function as a syntactic form of a subroutine with pure function. Allowing in/out arguments resolves that only partially. Pure functions (of different purity levels) are still needed. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de