<div class="gmail_quote">On Sun, Feb 7, 2010 at 5:18 PM, Tobias C. Rittweiler <span dir="ltr"><<a href="mailto:tcr@freebits.de">tcr@freebits.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Well, trying it again, this will now get me into ECL's native debugger</div>
which probably means that you forgot to heed *DEBUGGER-HOOK*.<div><div class="h5"><a href="https://lists.sourceforge.net/lists/listinfo/ecls-list" target="_blank"></a></div></div></blockquote><div><br></div><div>Your presumptions are wrong. Your code </div>
<div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(68, 68, 68); ">(handler-bind ((condition<br> #'(lambda (c)<br>
(format "~&Caught: ~S => ~A~%" c c))))<br> (compile-file "/tmp/frob.lisp"))</span></div></div><div><br></div>contains an error in the handler. That handler is invoked in a context in which the compiler handlers are not active, because this binding is an outer one. This means the error is not muffled (as you wanted) but it also means that the error is not just collected and printed, because the compiler error handler is not active. Hence the debugger is entered.<div>
<br></div><div>I do not bind *debugger-hook* in the compiler because that is not a coherent and comprehensive way of handling errors. Error handling in the compiler is done using handler bindings, </div><div><br></div><div>
<div>(defmacro with-compiler-env ((compiler-conditions) &body body)</div><div> `(let ((*compiler-conditions* nil))</div><div> (declare (special *compiler-conditions*))</div><div> (restart-case</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> (handler-bind ((compiler-note #'handle-compiler-note)</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>(warning #'handle-compiler-warning)</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>(compiler-error #'handle-compiler-error)</div>
<div> (compiler-internal-error #'handle-compiler-internal-error)</div><div> (serious-condition #'handle-compiler-internal-error))</div><div> (mp:with-lock (mp::+load-compile-lock+)</div>
<div> (let ,+init-env-form+</div><div> (with-compilation-unit ()</div><div> ,@body))))</div><div> (abort ()))</div><div> (setf ,compiler-conditions *compiler-conditions*)))</div>
<div><br></div><div>This approach is very similar to SBCL's but is organized in a way that compilation units can be nested. Here HANDLE-COMPILER-INTERNAL-ERROR is the routine that normally just collects errors and jumps to the ABORT restart.</div>
</div><div><br>Juanjo<br clear="all"><br>-- <br>Instituto de Física Fundamental, CSIC<br>c/ Serrano, 113b, Madrid 28006 (Spain) <br><a href="http://juanjose.garciaripoll.googlepages.com">http://juanjose.garciaripoll.googlepages.com</a><br>
</div>