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-20 15:36:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.net.uni-c.dk!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Re: Update-in-place assignment Date: Fri, 21 Jun 2002 00:35:59 +0200 Organization: Centre for Chaos and Turbulence Studies, Niels Bohr Institute Message-ID: <3D1258CF.3F4094DA@nbi.dk> References: NNTP-Posting-Host: alf.nbi.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.net.uni-c.dk 1024612559 11042 130.225.212.55 (20 Jun 2002 22:35:59 GMT) X-Complaints-To: usenet@news.net.uni-c.dk NNTP-Posting-Date: Thu, 20 Jun 2002 22:35:59 +0000 (UTC) X-Mailer: Mozilla 4.78 [en] (X11; U; OSF1 V4.0 alpha) X-Accept-Language: fo,da,no,sv,is,de,fr,en Xref: archiver1.google.com comp.lang.ada:26526 Date: 2002-06-21T00:35:59+02:00 List-Id: 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); I like this idea, but we should (as Rosen points out) also look at which opportunities it gives the programmer for creating the corresponding implementations. The least ugly construction I can come up with right now is to allow the use of "idem" on an argument to specify that even though it is formulated as a function, it is actually just a procedure where the "idem" argument is "in out". 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. Jacob -- "There is a slight error in the exponent" - quantum vaacum mass is 10^35 times the total dark matter mass