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,FREEMAIL_FROM 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-02-26 05:25:01 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nx02.iad01.newshosting.com!newshosting.com!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 26 Feb 2004 07:24:59 -0600 Date: Thu, 26 Feb 2004 08:24:58 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: In-Out Parameters for functions References: <1077718871.47635@master.nyc.kbcfp.com> <54cp3095jmv8s17h63d4bjdus0tec7l7pt@jellix.jlfencey.com> <1077721343.481619@master.nyc.kbcfp.com> <1077724400.221032@master.nyc.kbcfp.com> <1077727496.631820@master.nyc.kbcfp.com> <103q2cf890pus79@corp.supernews.com> <1077744815.17965@master.nyc.kbcfp.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <-tednUSWDcMxbqDdRVn-sw@comcast.com> NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-EH20oZAAcuEe5+GzGPmQwcY/GF2SFHo/Z3Loc9KQ1DpOsTIM3jktT+DJwYXE+eLskr3VRcNxPS6Yrqd!huh3V7XGqPrFyljMiCZPB10WcO54nKfDSTmHgBwZslX3UGT8S8ou4zMtewMDzg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:5841 Date: 2004-02-26T08:24:58-05:00 List-Id: Vinzent 'Gadget' Hoefler wrote: > Hyman Rosen wrote: > >> For the particular case of sqrt(x), where we're talking about Ada's >> built-in sqrt, and the only possible side-effect is for it to raise >> an exception. But if instead we have (gnurble(x) > 0.5 and b), and >> the compiler knows that b is false but has no information about >> what gnurble does, it must call gnurble(x) even though the result >> is irrelevant. > > > Yes, it should (I'm not sure, if it actually *has to*) call the > function if it is possible that the function has side-effects. > > What's your problem here? > That he has never read 10.2.1(18)? "If a library unit is declared pure, then the implementation is permitted to omit a call on a library-level subprogram of the library unit if the results are not needed after the call. Similarly, it may omit such a call and simply reuse the results produced by an earlier call on the same subprogram, provided that none of the parameters are of a limited type, and the addresses and values of all by-reference actual parameters, and the values of all by-copy-in actual parameters, are the same as they were at the earlier call. This permission applies even if the subprogram produces other side effects when called." Can't we just all agree that Hymen is not an Ada language expert and doesn't want to be? In this case, the rules of Ada are well thought out to allow any user, not the compiler to determine whether an "unnecessary" function call can be eliminated. Similarly, the language allows users to force syncronization points and orders of evaluation, when they are a necessary part of the algorithm being implemented. We have jokingly called for shooting a programmer who knowingly writes code that depends on order of evaluation and then--yes that is an Ada and then--doesn't document it or force the compiler to use the necessary order. Actually the correction applied would probably be education, warnings, bad reviews, and eventually firing the employee if nececssary. For anyone who deliberately persists in such bad habits, if necessary could be within weeks. Emphasis on deliberately, but I have had to make that decision for programmers who persisted in other bad habits like bypassing the required check-in procedures for software. In that case, firing the programmer probably saved him from a lynch mob, as other programmmers kept finding their submissions being rejected due to his changes not passing the regression tests. What do we do with Mr. Hymen Rosen? For now, I'm going to just post chapter and verse, and that Mr. Rosen's opinion on any Ada language issue should be ignored. -- Robert I. Eachus "The only thing necessary for the triumph of evil is for good men to do nothing." --Edmund Burke