Zach Beane xach@xach.com writes:
I don't want to run my whole system with (DEBUG 3), but sometimes I want to compile an individual function with (DEBUG 3) to e.g. get more precise source locations in the debugger.
The following is a patch that introduces this to slime, with an implementation for SBCL: if slime-compile-defun is given a prefix argument, it passes a request to the backend that the defun be compiled with maximum debug. The option is ignored on other backends.
Is there a specific reason why you implemented it the way you did?
Why not simply wrap the toplevel form to be compiled in a (LOCALLY (DECLARE (OPTIMIZE DEBUG)) ...)? This would be portable, and less invasive; your implementation may break functions that rely on TCO.
OTOH, persuaving the compiler to use high debug settings even though the function is locally declared to be optimized with low debug setting, is useful in some (rare, YMMV) cases. But is it common enough to justify the unportable implementation choice?
-T.