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,54889de51045a215 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-22 14:22:27 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: += in ada Date: 22 Oct 2003 14:22:26 -0700 Organization: http://groups.google.com Message-ID: References: <3F900F35.50203@comcast.net> <3F92B607.809@comcast.net> <3F937806.9080205@comcast.net> NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1066857747 31395 127.0.0.1 (22 Oct 2003 21:22:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 22 Oct 2003 21:22:27 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:1474 Date: 2003-10-22T14:22:26-07:00 List-Id: Lutz Donnerhacke wrote in message news:... > * Russ wrote: > > Lutz Donnerhacke wrote in message news:... > >> * Russ wrote: > >> > "Robert I. Eachus" wrote in message news:<3F937806.9080205@comcast.net>... > >> >> in a nutshell. Chad even gave a perfect riposte, to the question of > >> >> side effects. The statement x += y += 1; is perfectly legal C, and I'll > >> >> let Russ choose what is the effect, and what is the side effect. > >> > > >> > I'll tell you exactly what the effect is: a compile error. > >> > >> You should learn even C before ranting any further. > > > > I was programming a state-of-the-art experimental real-time precision > > landing system in C++ 10 years ago. > > You never learned the difference between effect and side effect in those > years? Your information reception ability seems very limited. OK, let me reply to this post for a second time, this time without the personal stuff. You're probably an intelligent fellow, and even though you insulted me first, I was out of line to refer to you as a "mental midget" in my first reply. As we all know, functions in C and C++ can modify their arguments *and* return values. Ada, on the other hand, distinguishes between functions and procedures. In Ada, functions can return something but cannot modify their arguments, whereas procedures can modify (some of) their arguments but cannot return anything. In C and C++, the data returned by a function is referred to as its "effect", and the modification of any arguments is referred to as its "side effect." In Ada, however, this jargon is unnecessary and misleading, unless you want to claim that a procedure has "no effect." Pedants might insist on such misleading jargon, but they are not using standard English. Getting back to "+=". In C/C++, the so-called "effect" of "+=" for built-in types is to return a reference. For user-defined types, the "effect" depends on whether the programmer decided to return a reference, in which case the "effect" is to return a reference. The actual incrementation of the argument is technically a "side effect." Is that what you wanted to hear? As I said, however, this jargon does not really apply to Ada. In Ada, the effect (in the standard English sense) of "+=" (or ":+") would be to increment the argument. Only if you insist on applying the disfunctional jargon of C/C++ functions can this be considered a "side effect". And that is why Mr. Eachus's concern about "x += y += 1" is completely and utterly irrelevant to Ada. It's nothing more than a red herring. Did you really think I didn't know this? Give me a break!