Subject: Re: Why no call with current continuation?
From: Erik Naggum <erik@naggum.no>
Date: 03 Oct 2002 14:01:40 +0000
Newsgroups: comp.lang.lisp
Message-ID: <3242642500692368@naggum.no>
* Dorai Sitaram
| *print-length* being a special variable, right? Then, the call to foo is
| not in a tail-call position.
This is not as obvious as you think, either. The unwinding that would
take place upon a return may well include special variable unbinding and
unwind-protect execution so a call to a function inside both may well be
able to inherit the call frame of the caller. The smart way to ensure
that special variables are unbound and unwind-protect forms are always
run is to arrange for the function to return to a system function that
does the necessary clean-up. When you do this, neither special bindings
nor unwind-protect forms would stand between you and tail-call merging.
| [1] That said, I do know of a rather academic paper from the early 1980s
| that treats getting something like special variables to not interfere
| with tail-calls, but it may not be of interest here.
Perhaps it is already widely implemented.
| To clarify: I too doubt that TCE will become part of CL.
It is already part of the implementations under suitable optimization.
Unlike the Scheme world, Common Lisp vendors are allowed to be smarter
than the specification.
| IOW: while both TCE and call/cc are unlikely, call/cc is unlikelier.
Perhaps you should try to study reality a little? Or is that unlikely?
--
Erik Naggum, Oslo, Norway
Act from reason, and failure makes you rethink and study harder.
Act from faith, and failure makes you blame someone and push harder.