From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.tele.dk!small.news.tele.dk!134.222.94.5!npeer.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: Tail recursion & CL References: <87iteghyva.fsf@pps.jussieu.fr> <87n13ndwus.fsf@pps.jussieu.fr> <87eloz8417.fsf@pps.jussieu.fr> <87r8syosjs.fsf@pps.jussieu.fr> <3210249273790367@naggum.net> <87pu89sgwr.fsf@pps.jussieu.fr> <871ykonwo8.fsf@Samaris.tunes.org> <87bsjsp2zh.fsf@photino.sid.rice.edu> <874rpjq3l1.fsf@photino.sid.rice.edu> Mail-Copies-To: never From: Erik Naggum Message-ID: <3210968437468418@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 25 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 01 Oct 2001 23:40:39 GMT X-Complaints-To: newsmaster@Norway.EU.net X-Trace: nreader1.kpnqwest.net 1001979639 193.71.66.49 (Tue, 02 Oct 2001 01:40:39 MET DST) NNTP-Posting-Date: Tue, 02 Oct 2001 01:40:39 MET DST Xref: archiver1.google.com comp.lang.lisp:17223 * Bruce Hoult | A function call is either the last function call in the body of the | function or else it is not. If it's last then tail-call it (with a | "jump"), if it's not last then call it the regular way (with a "jump to | subroutine"). But this is not quite as trivial as people seem to think. There are all kinds of low-level cleanup issues that may not be visible or even known to the programmer and which the compiler writer may need to be told about (either through a formal specification of a requirement or by invoking a local declaration) before it makes sense to allow for making a tail call into a jump. Also note that the callee needs to believe that it was called, unless the language has specified semantics to this effect, too. | "Last" means either the last expression evaluated in the function. This | means either being physically last, or else being the last expression in | an IF or COND (etc) that is physically last in the function. I think you might mean the form that evaluates to the value of the function. It might, for instance, be possible to unwind special bindings and unwind-protect forms in such a way that you could jump to a function with it returning to the cleanup forms, so the notion of "last" might be very confusing and counterproductive. ///