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.4 required=5.0 tests=BAYES_00,FREEMAIL_FROM, FREEMAIL_REPLY,THIS_AD autolearn=no 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-15 22:40:49 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: 15 Oct 2003 22:40:49 -0700 Organization: http://groups.google.com Message-ID: References: <3F7316F7.219F@mail.ru> <49cbf610.0310070205.2937e71a@posting.google.com> <49cbf610.0310101231.2358762a@posting.google.com> <49cbf610.0310150616.3503a1c4@posting.google.com> NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1066282849 22037 127.0.0.1 (16 Oct 2003 05:40:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 16 Oct 2003 05:40:49 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:944 Date: 2003-10-15T22:40:49-07:00 List-Id: dmytrylavrov@fsmail.net (Dmytry Lavrov) wrote in message news:<49cbf610.0310150616.3503a1c4@posting.google.com>... > 18k11tm001@sneakemail.com (Russ) wrote in message > > > > > OK, I can see how you could have misunderstand my point here, so let > > me clarify. > > > > I am *not* claiming that augmented assignment operators (":+", ":-", > > ":*", ":/") are good *because* 98% of programmers use them. What I am > > claiming is that 98% of programmers use them *because* they are a good > > idea. > I simply can't understand difference. > "Because of A,B is good" vs "B is good because of A" > In both cases you're referring to A,to "prove" that B is good,right? > And A="choise of 98%" ,so you're mean "be with 98%". The statements,"Because of A,B is good" and "B is good because of A" are indeed equivalent. But that's not the distinction I was making. My distinction is between "A is good because almost everybody uses it" and "Almost everybody uses A because it is good." This is a very fundamental distinction, and its is also the source of much subtle distortion. Let me give an example. I happen to believe that the war in Iraq was wise to pursue. A tyrant was toppled, 25 million people were freed from a hideous tyranny, and I believe that worldwide terrorism was dealt a massive (though obviously non-fatal) blow. You can be sure that Osama bin Laden was is not happy about the war and its outcome. You may not agree with me, but I did give two or three reasons to back my position. I understand that there are arguments for the opposite position, but I am offended when some anti-war protestor compares George W. Bush to Adolf Hitler. I think those protestors are unpatriotic idiots. But here's the critical point. I don't think they are idiots *because* they are unpatriotic; I think they are unpatriotic *because* they are idiots. The former would constitute simple-minded patriotism -- "My country, right or wrong." The latter constitutes intelligent patriotism -- "My country *is* right this time." Whenever someone criticizes the idiot protestors, the liberal media is usually there to subtly imply that it is due to the simple-minded sort of patriotism. But usually it isn't. I hope I made my point (considering how much time I just wasted on this post!). > We are talking about fact that infix procedures are more readable, > comparing a:+b with inc(a,b) ,right? What it have to do with > efficiency? I've explained this ad nauseum already, so I'll just sum it up. For user-defined types (vectors and matrices, for example), the augmented assignment operators allow the programmer to define in-place operations that do not need temporaries and extra copying as the standard math operators do. Consider the common operation of scaling a vector, for example. I could write vec := vec * factor or vec :* factor The first form requires the construction of a temporary, the actual scaling operation, then the copying back of the temporary to the original vector. The latter, on the other hand, can be written to avoid the construction of the temp and the copying back. And yes, it is possible for a "smart" compiler to automatically implement the former with the efficiency of the latter, but current compilers don't, and more complicated examples would be *extremely* difficult for the compiler to optimize.