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.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!uunet!seas.gwu.edu!mfeldman From: mfeldman@seas.gwu.edu (Michael Feldman) Newsgroups: comp.lang.ada Subject: Re: Reference vs. copy semantics in passing parameters Message-ID: <2750@sparko.gwu.edu> Date: 19 Feb 91 02:05:39 GMT References: <5572@baird.cs.strath.ac.uk> <1991Feb13.211643.25777@rti.rti.org> <2725@sparko.gwu.edu> <2742@sparko.gwu.edu> <16152@as0c.sei.cmu.edu> Reply-To: mfeldman@seas.gwu.edu () Organization: The George Washington University, Washington D.C. List-Id: In article <16152@as0c.sei.cmu.edu> ae@sei.cmu.edu (Arthur Evans) writes: >Jim Showalter (jls@yoda.Rational.COM) comments that Ada 9X might permit >functions to have parameters of mode IN OUT or OUT. > >An early draft of the Requirements Document included a requirement for >such a change. However, because of many comments opposing the change it >was removed from the final document. A good decision, IMHO. A function should be as nearly a "black box" as possible, which has no side effects. In Ada a function that has state memory (a pseudo-random number generator, for example), must have a side effect (of modifying a variable of the package body it's in, presumably). This could have been prevented if Ada had allowed _static_ data structures in subprograms, a la PL/1, C, and Fortran. But alas, it doesn't, and I'm sure it won't. But in any case, the client of the function should not be able to cause side effects. Just because other languages have "value-returning procedures" or "functions with side effects" (dpending on how you want to look at it) doesn't mean Ada needs to. Let functions be functions. Mike Feldman