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-07 04:56:37 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!elnk-pas-nf1!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread3.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <3FFC0201.6020303@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Certified C compilers for safety-critical embedded systems References: <3fe00b82.90228601@News.CIS.DFN.DE><5802069.JsgInS3tXa@linux1.krischik.com><1072464162.325936@master.nyc.kbcfp.com><1563361.SfB03k3vvC@linux1.krischik.com><11LvOkBBXw7$EAJw@phaedsys.demon.co.uk><3ff0687f.528387944@News.CIS.DFN.DE><1086072.fFeiH4ICbz@linux1.krischik.com><3ff18d4d.603356952@News.CIS.DFN.DE><1731094.1f7Irsyk1h@linux1.krischik.com><3ff1b8ef.614528516@News.CIS.DFN.DE> <3FF1E06D.A351CCB4@yahoo.com><3ff20cc8.635997032@News.CIS.DFN.DE><3ff9df16.30249104@News.CIS.DFN.DE> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Wed, 07 Jan 2004 12:56:36 GMT NNTP-Posting-Host: 209.165.26.216 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.atl.earthlink.net 1073480196 209.165.26.216 (Wed, 07 Jan 2004 04:56:36 PST) NNTP-Posting-Date: Wed, 07 Jan 2004 04:56:36 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:4165 Date: 2004-01-07T12:56:36+00:00 List-Id: What exactly would be the meaning of: A := Func_X (A) + Func_Y (A) ; if functions had in-out parameters and A could be modified while evaluating the RHS? I suppose one might be able to come up with some evaluation rules that at least meant determinism for the end result, but staring at it would not make it intuitively obvious to even the most casual observer. Sure, the functions *could* modify A if they had visibility to the right scope, but how often does someone do that in real-world use? The current style - while not guaranteeing a lack of side effects - tends to discourage it and leads to more easily comprehended code. I don't understand what the headache is here anyway. If one wants to modify parameters, use a procedure. If one wants some kind of math-oriented thingie to return a result, use a function. Only interfacing to squirly languages like C seems to be an issue - and I think that ought to be a difficult and painful thing to discourage it from happening. :-) MDC Jean-Pierre Rosen wrote: > > I've seen this argument quite often (especially by RBKD), but it is totally bogus. > Nobody claimed that functions should not have side effects, but only that functions compute a result given some parameters and the > global state of the program. It was felt that it was OK for a function to modify the global state, but modifying the parameters > would be surprising and error-prone. > > BTW, Ada79 had functions that were required to not have side effects, and value returning procedures that did not have this > constraint. This was felt to be too extreme (or maybe difficult to enforce) and the current solution to be an acceptable trade-off. > -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Face it ladies, its not the dress that makes you look fat. Its the FAT that makes you look fat." -- Al Bundy ======================================================================