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-01-30 09:52:44 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!feed1.news.rcn.net!rcn!wn14feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!not-for-mail From: David Starner Subject: Re: In-Out Parameters for functions User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity. (Debian GNU/Linux)) Message-Id: Newsgroups: comp.lang.ada References: <1075225041.167448@master.nyc.kbcfp.com> <1075303237.975898@master.nyc.kbcfp.com> <9khh10pti0dn8gcp7f18ghptaifluj0fud@4ax.com> <1075390647.405841@master.nyc.kbcfp.com> <1075405582.982776@master.nyc.kbcfp.com> <1075482385.142744@master.nyc.kbcfp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Fri, 30 Jan 2004 17:52:43 GMT NNTP-Posting-Host: 12.72.183.157 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1075485163 12.72.183.157 (Fri, 30 Jan 2004 17:52:43 GMT) NNTP-Posting-Date: Fri, 30 Jan 2004 17:52:43 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:5110 Date: 2004-01-30T17:52:43+00:00 List-Id: On Fri, 30 Jan 2004 12:06:26 -0500, Hyman Rosen wrote: > If I have (pidgin Ada again!) > x : 0..1 := 0; > function f : integer is begin x := 1 - x; return x; end f; > r : integer := f - f; > Then Ada legally permits r to be 1 or -1. That's what I call > unspecified, i.e., no single result is required. In a particular > fixed environment, it is likely that the above code will always > return the same value. If this is done in production code rather > than in a contrived example, and the order dependency isn't so > apparent, it will seem that everything is fine. Then a change in > environment can make the opposite result appear, and things may > be broken. > > Everyone here is saying "so don't do that", which is what we > C/C++ programmers always say, and which you Ada guys sneer at. Everyone uses arrays and pointers. They are a part of good code. So Ada people sneer about people who ignore problems even good programmers have. They don't sneer about unmaintainable code (because "the order dependency isn't [...] apparent") that they could make deterministic at the cost of good code. What happens when someone uses f-f later assuming it will be 1? Or if someone changes the code not to call f-f and fails to make the side effects that something else is depending on? This is bad code, and needs to be fixed at the program level, not the language level.