next up previous contents index
Next: Unknown Locations and Interrupts Up: Stack Frames Previous: Funny Frames   Contents   Index


Debug Tail Recursion

tail recursion tail

Both the compiler and the interpreter are ``properly tail recursive.'' If a function call is in a tail-recursive position, the stack frame will be deallocated at the time of the call, rather than after the call returns. Consider this backtrace:

(BAR ...) (FOO ...)
Because of tail recursion, it is not necessarily the case thatFOO directly called BAR. It may be that FOO called some other function FOO2 which then called BAR tail-recursively, as in this example:
(defun foo () ... (foo2 ...) ...)

(defun foo2 (...) ... (bar ...))

(defun bar (...) ...)

Usually the elimination of tail-recursive frames makes debugging more pleasant, since theses frames are mostly uninformative. If there is any doubt about how one function called another, it can usually be eliminated by finding the source location in the calling frame (section 3.5.)

For a more thorough discussion of tail recursion, see section tail-recursion.


next up previous contents index
Next: Unknown Locations and Interrupts Up: Stack Frames Previous: Funny Frames   Contents   Index
Peter Van Eynde 2001-03-08