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,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-19 09:55:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!wn3feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail Message-ID: <3D10B7C6.8030309@attbi.com> From: "Robert I. Eachus" Organization: Eachus Associates User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4.1) Gecko/20020314 Netscape6/6.2.2 X-Accept-Language: en,pdf MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? References: <3d0ce154_5@news.bluewin.ch> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 24.61.239.24 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1024505727 24.61.239.24 (Wed, 19 Jun 2002 16:55:27 GMT) NNTP-Posting-Date: Wed, 19 Jun 2002 16:55:27 GMT Date: Wed, 19 Jun 2002 16:55:27 GMT Xref: archiver1.google.com comp.lang.ada:26400 Date: 2002-06-19T16:55:27+00:00 List-Id: 18k11tm001@sneakemail.com (Russ) writes: >By the way, it's too bad that Ada wasted "/=" on "not equals. It would >be very useful for dividing a matrix by a scalar. For example, the >construct > >A := A / 2.0; > >is very inefficient because a temporary matrix must be created to >store A/2, then an assignment must be used to put the result back in >A. On the other hand, >the construct > >A /= 2.0 > >is not only much cleaner looking, it is much more efficient because >you can skip the temporary matrix and the assignment. And please don't >argue with me here, because you will only be showing your ignorance. Okay, I'll show my ignorance. Let's say that your hypothetical Ada 0Y compiler generated code without temporaries for the matrix operation A /= 2.0; Would it do the same for A /= 0.2? If it did, what would happen if one element resulted in an overflow? On the other hand, if you choose to have the compiler use non-signalling infinities for such overflows, then it is easy enough for the compiler to do the inlining for all matrix op scalar combinations. So as I see it, the issue here is not syntax, it is the Ada rule that an exception on the right hand side of an assignment statement does not destroy the target of the assignment. If you are willing to dispense with that, you don't have Ada. If you are proposing to add a syntax (such as Foo++;) for such operations, go ahead. Most of us will be content with Inc(Foo); for cases where exceptions are not an issue. Personally, I do define Inc for modular types, and I even have some code which defines both: procedure Inc(X: in out Modular); and function Inc(X: in Modular) return Modular; I should probably lose some sleep over the potential confusion to the reader, but it has never bothered me. ;-)