From: | Martin Ward <martin@gkc.org.uk> |
Newsgroups: | comp.compilers |
Date: | Sun, 10 Jun 2012 10:42:05 +0100 |
Organization: | Compilers Central |
References: | 12-03-012 12-06-013 12-06-014 |
Keywords: | design |
Posted-Date: | 11 Jun 2012 02:09:00 EDT |
On Thursday 07 Jun 2012 at 18:21, "Johann 'Myrkraverk' Oskarsson"
<johann@2ndquadrant.com> wrote:
> Another point to make. Why do we assign from right to left? Is it in
> any way natural? What's wrong with
>
> a + b --> c "a plus b assigned to c"
>
> instead of
>
> c <-- a + b "c becomes a + b?"
>
> The more I think about it, I believe the former construct is a bit more
> natural since we read from left to right. However, I'd want to see or
> work on a non-trivial project in such a language to make up my mind.
It sounds like you want COBOL, which has:
MOVE A TO B
ADD A TO B GIVING C
Or, if you want it the other way around:
COMPUTE C = A + B
You can also say:
ADD A TO B
which puts the result in B. On the other hand:
MULTIPLY A BY B
puts the result in A!
Then there's:
DIVIDE A BY B
(or is it "DIVIDE A INTO B"?)
My point is that by trying to be more "natural" and follow
English language rules, rather than a concise and consistent
set of rules, COBOL ends up with something verbose
and inconsistent.
--
Martin
STRL Reader in Software Engineering and Royal Society Industry Fellow
martin@gkc.org.uk http://www.cse.dmu.ac.uk/~mward/ Erdos number: 4
G.K.Chesterton web site: http://www.cse.dmu.ac.uk/~mward/gkc/
Mirrors: http://www.gkc.org.uk and http://www.gkc.org.uk/gkc
Return to the
comp.compilers page.
Search the
comp.compilers archives again.