Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!spool.mu.edu!think.com!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.lisp Subject: Re: weird common lisp feature Keywords: read, read-line Message-ID: <1991Feb23.072613.9565@Think.COM> Date: 23 Feb 91 07:26:13 GMT References: <1991Feb21.104336.26012@Think.COM> <18935@brahms.udel.edu> <964@creatures.cs.vt.edu> Sender: news@Think.COM Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 27 In article <964@creatures.cs.vt.edu> lavinus@csgrad.cs.vt.edu () writes: >Everyone seems to be missing a basic point of Lisp philosophy: If you do >something like (foo a) (foo2 b), you should not count on that being evaluated >left-to-right or right-to-left. Generally, it is good programming practice >(in general, but especially in Lisp) not to make any assumptions about order >of evaluation unless the *language* (not the compiler) guarantees some >particular order (the only example I can think of offhand is C - it guarantees >order of evaluation of most everything). The original question was about KCL, which is an implementation of Common Lisp. Common Lisp *does* guarantee left-to-right order of evaluation, just as its predecessors Maclisp and Zetalisp did. Scheme doesn't specify the order of evaluation of function arguments. Also, in the example he gave the two expressions weren't even arguments to a function, they were top-level forms in a function definition. All recent Lisps that I'm aware of guarantee that top-level forms in a function will be evaluated in order (maybe some concurrent Lisps are exceptions). As if you hadn't put your foot in your mouth far enough, you then get it wrong regarding C as well. C doesn't specify the order of evaluation of arguments to functions and some operators. -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar