comp.lang.ada
 help / color / mirror / Atom feed
From: Bill Findlay <bill@wfindlay.demon.co.uk>
Subject: Re: Update-in-place assignment
Date: Fri, 21 Jun 2002 19:18:01 +0100
Date: 2002-06-21T19:18:01+01:00	[thread overview]
Message-ID: <B9392C69.1C26D%bill@wfindlay.demon.co.uk> (raw)
In-Reply-To: 3D1258CF.3F4094DA@nbi.dk

On 20/06/2002 23:35, in article 3D1258CF.3F4094DA@nbi.dk, "Jacob Sparre
Andersen" <sparre@nbi.dk> 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)





      reply	other threads:[~2002-06-21 18:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-19 20:57 Update-in-place assignment Bill Findlay
2002-06-19 21:38 ` Hyman Rosen
2002-06-20 22:35 ` Jacob Sparre Andersen
2002-06-21 18:18   ` Bill Findlay [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox