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,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-06 13:20:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!nntp4.savvis.net!uunet!dfw.uu.net!sac.uu.net!ash.uu.net!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: 06 Jun 2003 16:20:44 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <3EDCBDF4.1050900@attbi.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1054930844 24771 199.172.62.241 (6 Jun 2003 20:20:44 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 6 Jun 2003 20:20:44 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:38772 Date: 2003-06-06T16:20:44-04:00 List-Id: 18k11tm001@sneakemail.com (Russ) writes: > Stephen Leake wrote in message news:... > > > procedure Matrix_Add > > (Target : in out Matrix_Type; > > Addend : in Matrix_type); > > procedure "+=" (...) renames Matrix_Add; > > > > > > A += B; > > > > the compiler actually does: > > > > C = A; > > Matrix_Add (C, B); > > A = C; > > > > I suppose you could change that rule, but that would be a bigger > > change to the language, since "A += B" would no longer be identical to > > "A := A + B". > > You seem to be going around in circles here. The whole idea was that A > += B can avoid the temporary matrix and the extra copy operation. > That's how it works in C++. Without that benefit, yes you might as > well just use A := A + B. This is all speculation, since Ada does not *have* a +:= operator. It seems to me that if it did, the semantics should be identical to any other procedure call with two parameters (one 'in out', and one 'in'). It should *not* be similar to a *function* call, and should not return a result. If all that were true, then of course +:= would be exactly as efficient as Matrix_Add. Somebody has apparently suggested a different semantics for +:=, which might have different efficiency properties. - Bob