I'm trying to learn common lisp currently and I've been using sbcl (I hope that's a decent implementation choice.)
Coming from ruby and irb I find the automatic moved to a debugger on every mistake a little annoying at this time. Is there a way to turn it off temporarily when I'm playing around.
Common Lisp has a variable *debugger-hook*, which can be bound/set to a function.
* (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}>
*
There is a --disable-debugger
command-line option, e.g.:
$ sbcl --disable-debugger
From the man page:
By default when SBCL encounters an error, it enters the builtin debugger, allowing interactive diagnosis and possible intercession. This option disables the debugger, causing errors to print a back‐trace and exit with status 1 instead -- which is a mode of operation better suited for batch processing. See the User Manual on SB-EXT:DISABLE-DEBUGGER for details.
There are also --noinform
and --noprint
CL options you may find useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With