Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!bloom-beacon!THINK.COM!gls From: gls@THINK.COM (Guy Steele) Newsgroups: comp.lang.scheme Subject: Scheme Digest #293 Message-ID: <9002061810.AA03161@ungar.think.com> Date: 6 Feb 90 18:10:51 GMT References: Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 22 But HOW can it be done? I think the problem is to determine in every application of a compound procedure if it is the last command which is evaluated in a procedure. Another point of view is that the problem is to construct a framework in which application does not require conditional treatment. This can be done. The idea is that a procedure call *never* adds anything to the stack; *all* calls, as such, are tail-recursive. However, not all *evaluations* are tail-recursive. A frame must be added to the stack whenever one is about to evaluate a function argument, or the predicate part of a conditional, or any form except the last in a block, or in general whenever one is about to evaluate a subform but must regain control again. For a more extensive treatment of this topic, see my paper "Procedure Call Implementations Considered Harmful" in the Proceedings of the 1977 ACM National Conference. Happy hacking! --Guy Steele