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-05 11:04:50 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: 05 Jun 2003 13:56:19 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <6vWcnTWjF83bD0qjXTWcpA@gbronline.com> <3EDCBDF4.1050900@attbi.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1054836752 22923 128.183.235.92 (5 Jun 2003 18:12:32 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 5 Jun 2003 18:12:32 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.ada:38721 Date: 2003-06-05T18:12:32+00:00 List-Id: 18k11tm001@sneakemail.com (Russ) writes: > Stephen Leake wrote in message news:... > > 18k11tm001@sneakemail.com (Russ) writes: > > > > > > (And let's not forget that Ada *can* compute the result matrix in-place, > > > > just not using the notation you prefer. It's a strange performance-oriented > > > > programmer who gives up a factor of 4 for aesthetic reasons.) > > > > > > But Mr. Duff says that "+=" is just "syntactic sugar" for "Add(A,B)," > > > > Mr. Duff forgot about the Constraint_Error issues. > > > > > and Mr. Eachus says "+=" needs a temporary to preserve A in the case > > > of a Constraint_Error. > > > > He's right, since the language defines that behavior. But since _you_ > > write "Add", you get to decide what happens for Constraint_Error, so > > you _don't_ need a temporary. > > I think you're missing something here. I would write "+=" too. Yes, but the compiler would insert a temporary variable, in order to follow the language definition of the behavior of += in the presence of Constraint_Error. So if you write: 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". -- -- Stephe