Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!uwm.edu!rpi!uupsi!sunic!kth.se!ugle.unit.no!hanche From: hanche@imf.unit.no (Harald Hanche-Olsen) Newsgroups: comp.lang.scheme Subject: Re: Tail-calling and garbage collection Message-ID: Date: 16 Feb 91 23:24:34 GMT References: <9102112032.AA03542@cymbal.reasoning.com.> Sender: news@ugle.unit.no Organization: The Norwegian Institute of Technology, Trondheim, Norway. Lines: 30 In-Reply-To: carlton@husc10.harvard.edu's message of 15 Feb 91 17:20:42 GMT In article carlton@husc10.harvard.edu (david carlton) writes: In article harlan@copper.ucs.indiana.edu (Pete Harlan) writes: Certainly a compiler for any language may perform tail-call optimization, and in this respect it is a language-independent issue. However, when a *language*, rather than a compiler, guarantees an optimization, it opens the door for a programming style that might not be a portable program in the language if the optimization were not guaranteed. really? the scheme semantics doesn't mention tail recursion anywhere that i can tell, which would seem to imply that optimizing it out doesn't change the actual meaning of a program. indeed, i have a hard time seeing how it could, since converting a tail-recursive function call to a jump merely involves throwing out information that is useless, so it is hard for me to see how it could possibly change the meaning of anything. On a machine with infinite memory, optimizing tail recursion does not change the meaning of programs. However, in Scheme you can write a loop using a tail call and the loop can execute millions of times without running out of memory if it can do it once. I'd say that whether or not the program runs out of memory changes its meaning, whether the semantics say so or not ... - Harald Hanche-Olsen Division of Mathematical Sciences The Norwegian Institute of Technology N-7034 Trondheim, NORWAY