Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!hsdndev!husc6!carlton From: carlton@husc10.harvard.edu (david carlton) Newsgroups: comp.lang.scheme Subject: Re: Fixing the order of evaluation. Minimizing the unexpected. Message-ID: Date: 6 Apr 91 08:11:07 GMT References: <9104041629.AA19876@schizo> Sender: news@husc6.harvard.edu Organization: Citizens for Boysenberry Jam Lines: 98 In-reply-to: gjc@mitech.COM's message of 4 Apr 91 15:24:09 GMT In article <9104041629.AA19876@schizo> gjc@mitech.COM writes: But lets be practical. Undefined order of evaluation, (undefined *anything* really) is one of the big things that gets in the way of most people learning a computer language. OK. Order of evaluation may be undefined. However, I ASK: *What* useful thing has the person who learns this fact of (some) computer languages REALLY LEARNED? Is it a reasonable stepping stone in intelectual developement? (To never trust the computer? To always be on the look out for ways it might screw you?) Face it. People understand the written word, and written directions are given to people in this format: LEFT-TO-RIGHT, TOP-TO-BOTTOM. Period, fact of life. (Yes, there are some right-to-left languages, but no bottom-to-top languages. And even our common western experience includes a NUMERIC representation stolen from an Arabic culture, which is right-to-left. And the confusion this has caused is even reflected in our COMPUTER HARDWARE, the silly Big-Endian, Little-Endian crap.) Does the community of Scheme programmers really gain enough from having an undefined order of evaluation of arguments to a procedure? Does it gain enough to make up for the losses faced as people learn the language. (Or in the long run, less usage of the language). I could be convinced! I think that learning Scheme can, for many people, be as much a process of unlearning as a process of learning. For example, in many other programming languages, functions aren't first class objects. In Scheme, they are. I submit that this should be looked at as a process of unlearning, since in Scheme objects are treated more uniformly, while in other languages some kinds of objects are treated specially. Similarly, in many other languages the function position of a function call is evaluated differently than the other positions, while in Scheme it is not - again, we have a special case to "unlearn". And I think that an undefined order of evaluation is another such things - you have to "unlearn" the idea that arguments should be evaluated in some order. So we have the question "*What* useful thing has somebody who has learned this fact of (some) computer languages REALLY LEARNED? Is it a reasonable stepping stone in intellectual development?" My nomination for the useful thing is the principle of simplicity. Don't add rules when you don't have to. Don't specify something when it is not clear how it should be specified, unless there is some overriding reason to specify it in some manner. This is a very useful concept, and is the way that lots of progress has been made - advances in mathematics, for example, often come about by looking at an old problem in a newer, more general manner, which can be considered to be the same sort of unlearning that I am talking about here. As to the order of left-right being "natural": this is a very Anglo-centric viewpoint, I think. (Of course, calling your conditional "if" is also Anglo-centric - but you have to call your conditional _something_, whereas you don't have to specify your order of evaluation, and at any rate I am only trying to lay arguments about the way the brain is wired or how western brains are taught to rest.) As has been pointed out, many writing systems work from right to left. And many work from top to bottom. (Signs painted on streets can even be written from bottom to top - for example, you sometimes see signs CROSSING SCHOOL SLOW and the like on roads.) Some even alternate going from right to left and left to right (early Greek inscriptions sometimes do this, and they reverse the letters when going right to left), or even weirder things than that. (For example, cuneiform was often written left to right, then flipping the tablet over (writing on the edge) and writing until you reach the end of the other side, then writing right to left, flipping the tablet over and writing on the edge again.) And, as gjc pointed out, even within our own cozy English world, not everything is done left to right, numerals being the obvious example. (Depending on how you look at it. For that matter, the German way of pronouncing numbers is somewhat reminiscent of Jinx's proposal for order of evaluation. And, to bring in another example, at some point in the development of Old Irish every other syllable of words got deleted, also a bit reminiscent of Jinx's proposal.) This is not to say that there isn't an argument to be made for doing things left to right, since there is - Scheme parsers work from left to right, after all, with multiple expressions in a file being evaluated from left to right and top to bottom, and the same for the order of evaluation of statements within a begin expression, so if you are going to impose an order of evaluation for the procedure and arguments of a function call then it should certainly be left to right (with the procedure evaluated before everything else) - but please don't make arguments about it being something universal to western culture. david carlton, who thinks that function application should be written with the function on the _right_ since that makes function composition work out more neatly.