Ideas from the Chapel language (swap)
Derek Parnell
derek at psych.ward
Thu Oct 4 06:11:28 PDT 2007
On Thu, 04 Oct 2007 17:55:05 +0900, Bill Baxter wrote:
> I find it hard to believe that a compiler couldn't recognize that this
> is a swap operation:
> tmp = a;
> a = b;
> b = tmp;
>
> If it's not harder than I think for some reason, then it's not really
> needed in the language.
Maybe it could, but that's not the point of a programming language. A
programming language is for people, not computers, to read. It is whole lot
easy to recognise "swap(a,b)" or even "a<->b" as a swapping operation than
three lines of code.
--
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell
More information about the Digitalmars-d
mailing list