Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!ai-lab!zurich.ai.mit.edu!markf From: markf@zurich.ai.mit.edu (Mark Friedman) Newsgroups: comp.lang.scheme Subject: Re: Fixing the order of evaluation. Minimizing the unexpected. Message-ID: Date: 4 Apr 91 20:50:30 GMT References: <9104041629.AA19876@schizo> Sender: news@ai.mit.edu Reply-To: markf@zurich.ai.mit.edu Organization: M.I.T. Artificial Intelligence Lab. Lines: 78 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? They may have learned that Scheme (as intended by most of its designers) is a mostly functional language with imperative features which should be used in carefully controlled ways. Ways are provided to control order of evaluation but the evaluation of procedure arguments is not one of them. Note that having the the order of evaluation of procedure arguments be undefined is not zero knowledge; it tells you not to depend on any particular order. Do most people who may be able to use a computer language give a tinkers damn about what some compiler-writing person knows? Or what some group of language implementors think they know about programming style? Implicitly they do. Real users want their programs to run efficiently. That means that compiler writers had better know something. One of the reasons the user of any particular programming language chooses it is because he wants to write his programs in a style that is well supported by the language. 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. Although our (western) eyes may move LEFT-TO-RIGHT, TOP-TO-BOTTOM, the cognitive parsing is more complex, especially for some other languages (Latin, for instance). In any case, I assume that you are not proposing that we program in English (or even COBOL). (Yes, there are some right-to-left languages, but no bottom-to-top languages...) This may be true for natural languages, but not computer languages in general. How about: foo (bar (baz (grumble (x)))) which in most computer languages (including your exemplar C) evaluates pretty much bottom up. And, of course, we have: x + ((y * (z - (n / k) + a)) - 6) which evaluates inside out, left to right, right to left and does the hokey pokey. Does the community of Scheme programmers really gain enough from having an undefined order of evaluation of arguments to a procedure? That's the key question. I don't know the answer. -Mark -- Mark Friedman MIT Artificial Intelligence Lab 545 Technology Sq. Cambridge, Ma. 02139 markf@zurich.ai.mit.edu