> So, the debugger uses call/cf (short for call-with-continuation-frame) > which is like the "raw" equivalent of call/cc. The debugger doesn't > need to do anything with the actual frame other than comparing it with > the last captured frame: if they're eq?, we're in tail call, if not, > then it's a nontail call. The debugger then treats the two cases > accordingly (details omitted).
Incidentally a footnote in "A Monadic Framework for Delimited Continuations" says "In Chez Scheme, this is accomplished by comparing the current continuation against a base continuation using eqv*... *Unfortunately, this makes the code unportable; to our knowledge, no other Scheme system allows eqv? to be used on continuations in this manner." I suppose with actual stack frames eq? is going to work. But do you any Scheme systems apart from Chez (and I think Ikarus too) that support eqv? on continuations? Is it essentially the same as supporting eqv? on procedures? On Wed, Jun 3, 2009 at 11:12 PM, Abdulaziz Ghuloum <[email protected]> wrote: > > On Jun 3, 2009, at 3:39 PM, Michele Simionato wrote: > >>> It only uses one ikarus-specific feature (call/cf >>> which gives you an eq?-comparable pointer onto the stack). It >>> also has a simple interface between the compiler/interpreter >>> and the debugger, e.g., rewrite all >>> (proc args ...) >>> => >>> (debug-call '<source-info> proc args ...) >>> and you get debuggable/traceable code. >> >> But how does it work with TCO? In debug mode TCO >> is disabled or not? > > Of course not. If you disable that, most programs won't run at all. > (and that's why it should never be called "optimization") > > The real details of how it works is in the code, since I didn't write > any of the details on paper (which I should, once I finish the paper > at hand). > > In short, the debugger is like the tracer, it doesn't care (or need > to know off-hand) if a call is really a tail call or not. It can > figure that out dynamically simply by observing that: > > "one call is in tail position with respect to another > if both calls have the same continuation" > > So, the debugger uses call/cf (short for call-with-continuation-frame) > which is like the "raw" equivalent of call/cc. The debugger doesn't > need to do anything with the actual frame other than comparing it with > the last captured frame: if they're eq?, we're in tail call, if not, > then it's a nontail call. The debugger then treats the two cases > accordingly (details omitted). > > [you can ask yourself why I choose to do this dynamically instead of > determining tail/nontail calls statically at the source level. It's > a good puzzler since that's how I thought it should work initially] > > Aziz,,, >
