我目前正在尝试学习 common lisp,并且我一直在使用 sbcl(我希望这是一个不错的实现选择。)
我来自 ruby 和 irb,我发现在每次错误时自动移动到调试器在这个时候有点烦人。有没有办法在我玩的时候暂时关闭它。
最佳答案
Common Lisp 有一个变量 *debugger-hook* ,它可以绑定(bind)/设置为一个函数。
* (aref "123" 10)
debugger invoked on a SB-INT:INVALID-ARRAY-INDEX-ERROR:
Index 10 out of bounds for (SIMPLE-ARRAY CHARACTER
(3)), should be nonnegative and <3.
Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(SB-INT:INVALID-ARRAY-INDEX-ERROR "123" 10 3 NIL)
0] 0
* (defun debug-ignore (c h) (declare (ignore h)) (print c) (abort))
DEBUG-IGNORE
* (setf *debugger-hook* #'debug-ignore)
#<FUNCTION DEBUG-IGNORE>
* (aref "123" 10)
#<SB-INT:INVALID-ARRAY-INDEX-ERROR {1002A661D1}>
*
关于debugging - 如何在 sbcl 中关闭调试器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3074586/