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,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-27 02:24:02 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: wojtek@power.com.pl (Wojtek Narczynski) Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions Date: 27 Jan 2004 02:24:01 -0800 Organization: http://groups.google.com Message-ID: <5ad0dd8a.0401270224.29781e65@posting.google.com> References: <5ad0dd8a.0401260606.76cc4415@posting.google.com> NNTP-Posting-Host: 80.54.181.211 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1075199041 17148 127.0.0.1 (27 Jan 2004 10:24:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 27 Jan 2004 10:24:01 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:4891 Date: 2004-01-27T02:24:01-08:00 List-Id: > And use this global variable Y for computing their results? > If you really can easily imagine all that mess for professional Ada > programmers then perhaps you must be sent back to undergraduate courses -;) . Yes, I can imagine that. If the professional programmer only looks at the specification of those functions, he or she will not know. This is why I think F + G is worse than F(Y) + G(Y), even if the result of this expression depends on the order of evaluation of F and G. > Note that there are fully legitimate and safe cases where functions actually > read and write global variables, but *not use those variables for computing > thier results*. (I think that in majority of reasonable cases where several > functions use the same global variable both for reading and writing, that > global variable is an array). For function with side effects to remain a function, you need to consider all its inputs and outputs. It doesn't matter wether you 'return' a result or store it in a global variable. > You are in hurry? You expect end of the world? -:) Well, I think that you'll > be able to formulate some good *exact and complete* rule of this kind not > earlier than the ARG will call for proposals for Ada1Z -;) . No rule that would break a lot of code will ever go in. Regards, Wojtek