Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site lsuc.UUCP Path: utzoo!lsuc!msb From: msb@lsuc.UUCP (Mark Brader) Newsgroups: net.lang Subject: Re: Reading programs left-to-right. Message-ID: <752@lsuc.UUCP> Date: Tue, 13-Aug-85 13:08:05 EDT Article-I.D.: lsuc.752 Posted: Tue Aug 13 13:08:05 1985 Date-Received: Tue, 13-Aug-85 13:33:54 EDT References: <6571@boring.UUCP> Reply-To: msb@lsuc.UUCP (Mark Brader) Organization: Law Society of Upper Canada, Toronto Lines: 26 Summary: The usual way makes it easy to see what's assigned to. Jack Jansen asks why so many languages have assignments with the destination on the left so that, in some sense, the statement must be executed right to left. I think there are two reasons. First is the parallel with mathematical notation where the unknowns conventionally go on the left; the assignment destination is like an unknown since it's just being computed. Second and more important, statements are aligned by the left, and the most important thing to know in a short segment of a program is what variables are changed. So the destination-on-the-left means that those variables are nicely lined up for you. Compare: apples = oranges + lemons; pairs = triplets * quartets[quintets]; answer -= 42; and: add oranges, lemons giving apples. multiply triplets, quartets(quintets) giving pairs. subtract 42 from answer. I think it's much easier to see in the C example that it's apples, pairs, and answer that are being computed than it is in the COBOL example. Mark Brader