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,e0433e9cff080c9c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-21 11:40:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!wfindlay.demon.co.uk!not-for-mail From: Bill Findlay Newsgroups: comp.lang.ada Subject: Re: Update-in-place assignment Date: Fri, 21 Jun 2002 19:18:01 +0100 Message-ID: References: <3D1258CF.3F4094DA@nbi.dk> NNTP-Posting-Host: wfindlay.demon.co.uk X-NNTP-Posting-Host: wfindlay.demon.co.uk:158.152.131.179 X-Trace: news.demon.co.uk 1024684753 nnrp-13:16096 NO-IDENT wfindlay.demon.co.uk:158.152.131.179 X-Complaints-To: abuse@demon.net User-Agent: Microsoft-Entourage/10.1.0.2006 Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Xref: archiver1.google.com comp.lang.ada:26574 Date: 2002-06-21T19:18:01+01:00 List-Id: On 20/06/2002 23:35, in article 3D1258CF.3F4094DA@nbi.dk, "Jacob Sparre Andersen" wrote: > Bill Findlay wrote: > >> There is a case to be made for being able to specify that a component of an >> expression being assigned is the same as the destination of the assignment. > [...] >> E.g. we might have i := idem -1; or i := 1 - idem; >> or even x := 0.5 * (1.0 + a*idem); > ... > > function "*" (Left : idem Matrix; > Right : in Float) return Matrix; > > should thus on the implementation side of things correspond > to > > procedure "+" (Left : in out Matrix; > Right : in Float); > > But this doesn't contain any of the beauty of your > suggestion. Maybe it is best to leave it as an exercise for > the compiler to translate the expressions to the optimal > code. > That's my view. It's hardly rocket science to give optimal code in the simple cases supported by update-in-place m/c instructions (where available) and you'll be at least no worse off in more complex expressions than you would be without idem. -- Bill Findlay bill@wfindlay.demon.co.uk (personal) wf@dcs.gla.ac.uk (Glasgow University) bfindlay@sli-institute.ac.uk (The SLI Institute)