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,1116ece181be1aea X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-09-17 12:11:00 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: Is the Writing on the Wall for Ada? Date: 17 Sep 2003 12:10:59 -0700 Organization: http://groups.google.com/ Message-ID: References: <3F650BBE.4080107@attbi.com> <3F67AAC6.2000906@attbi.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 1063825859 21718 127.0.0.1 (17 Sep 2003 19:10:59 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 17 Sep 2003 19:10:59 GMT Xref: archiver1.google.com comp.lang.ada:42634 Date: 2003-09-17T19:10:59+00:00 List-Id: Wes Groleau wrote in message news:... > Robert I. Eachus wrote: > > Wes Groleau wrote (to Russ): > > > Interesting how you were not able to persuade any of us ignoramuses > > > that temporaries are always needed without it nor that they are never > > > needed with it. > > > > Let me tell you a story with names removed [snip interesting story] > > > > Both Ada and Fortran were willing to allow her not to use temporaries, > > as long as the compiler could verify that this particular gotcha didn't > > occur. > > The story was interesting, but whether due to my IQ > or the fact it's an hour past my bedtime, I must confess > I do not know whether you were illustrating my point > or agreeing with Russ. > > (Russ insists that A += 1 never needs temporaries > and that A := A + 1 always does.) That's not *quite* what I insist. What I insist is that, for vector/matrix operations, "+" is a *function* that must create a temporary vector/matrix and return it, and it must be *copied* to the lhs. On the other hand, "+=" is a *procedure* that does not necessarily need any temporaries because it can do its operations "in place". No temporaries, no extra copying. In the previous thread, someone claimed that "+=" needs a temporary too for some sort of overflow checking (I don't recall the exact reason given). If that is true, then it is an example of an inherent inefficiency built in to Ada. For better or worse, C++ has no such inefficiency. (I'm just stating a fact, I am *not* claiming that C++ did it right.) Someone else also claimed that a good Ada compiler can make "+" as efficient as "+=", but I don't see how that could be possible, considering that I could define "+" and "+=" to do anything I want. Nothing in the language requires me to define "+" to actually do matrix addition. I could define it to write poetry if I wish. And let's not forget that a properly defined "+" should be able to handle sequential addition, such as A = B + C + D + E. No matter how you slice it, each of those additions needs a temporary. On the other hand, you could write A = B A += C A += D A += E It's not as elegant, but no temporaries or extra copying are required (unless the language imposes them for extraneous reasons).