When I try to trace a function defined with labels (like following):
(defun test (x max) (labels ((x-label (x) (if (< x max) (x-label (1+ x)) (x)))) (x-label x)))
I get this message:
:LABELS fell through ECASE expression. Wanted one of (:CALL :DEFGENERIC :DEFMETHOD SETF). [Condition of type SB-KERNEL:CASE-FAILURE]
I saw that someone in 2006 (http://common-lisp.net/pipermail/slime- devel/2006-April/004811.html) reported this problem, what's the current status?
I tried with sbcl and cmucl, I get the same result. I use slime-2.0
* Jean-Philippe Barrette-LaPierre [2007-09-04 21:31+0200] writes:
I tried with sbcl and cmucl, I get the same result. I use slime-2.0
I think that SBCL doesn't support tracing of local functions.
Raymond Toy did some work on that for CMUCL, but AFAIK it only works if the compiler makes certain choices. E.g. it works if the local function escapes. If I try to trace your example with CMUCL's trace like:
(trace (labels x-labels test))
I only get the error: No such function (LABELS X-LABEL TEST) That's in CMUCL 19d.
It seems to work for something like
(defun test2 (x max) (labels ((x-label (x) (if (< x max) (x-label (1+ x)) (x)))) (cons (x-label x) #'x-label)))
(compile 'test2) (trace (labels x-label test2)) (test2 1 3)
But (untrace (labels x-label test2)) doesn't work.
In summary, tracing of local functions isn't well supported by the implementations and consequently SLIME doesn't even try to offer a convenient interface.
Helmut.