Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!ai-lab!zurich.ai.mit.edu!jinx From: jinx@zurich.ai.mit.edu (Guillermo J. Rozas) Newsgroups: comp.lang.scheme Subject: Re: Order of evaluation (was Re: evaluating () should be an error Message-ID: Date: 27 Mar 91 16:40:32 GMT References: <2977@kraftbus.cs.tu-berlin.de> <1991Mar26.155905.12906@daffy.cs.wisc.edu> <1991Mar26.224805.23381@cs.ubc.ca> <1991Mar27.101357.20383@news.cs.indiana.edu> Sender: news@ai.mit.edu Reply-To: jinx@zurich.ai.mit.edu Organization: M.I.T. Artificial Intelligence Lab. Lines: 50 In-reply-to: hieb@heston.cs.indiana.edu's message of 27 Mar 91 15:13:39 GMT Saving registers around a call to an unknown procedure is not likely to substantially slow down code, due to the call overhead. In practice, I don't think an optimizing compiler is going to be significantly handicapped. The compiler can always reorder arguments it can prove are independent of evaluation order, and since these are likely to the be the simplest arguments they are likely to gain the most from such reordering. You've made this argument before, and my usual reply is: Write such a theorem prover and after examining it, and how well it performs, I may finally agree with you, but will not a-priori. I don't believe that your intuition is any better than mine, but I admit the possibility that you may be right, and will let you prove it to me. :-) Scheme is hiding its head in the sand with respect to argument evaluation order and unspecified return values. Arguments do get evaluated in some order and values are returned. Wishing that it weren't so is of little use to the producers and consumers of supposedly portable programs. I think you are getting upset over a relatively minor problem. C doesn't specify the order or argument evaluation, and the writing style is very imperative, and yet this hardly ever affects people porting programs. In Scheme, where the writing style is much more functional, it is likely to affect them even less. Therefore I don't buy your argument on portability. I think that you are trying to prove programs correct and that this gets in your way, so you claim it is a problem for everyone else. You should not use unsubstantiated arguments to get me to agree with you. You should convince me that proving programs correct is important and that this really gets in your way when doing so. BTW, no one has mentioned that implementations disagree on the order of evaluation of arguments and the value returned by SET!, and this is mostly why there was no agreement at the first R2RS meeting, where the concern was NOT porting programs, but reading each other's code. As far as I understand it, the reports are still NOT concerned with portability, but mutual legibility. The IEEE standard is concerned with portability, but that's a whole different story. FYI, MIT Scheme returns the OLD contents of the location on an assignment, and the MIT Scheme interpreter evaluates arguments right-to-left. The MIT Scheme compiler chooses whatever order it finds convenient and makes use of this freedom quite frequently. This trips someone about once every 18 months because they naively expect left-to-right to work. Once they understand what their problem was, they don't get bitten again.