|
|
|
|
|
by travv0
1992 days ago
|
|
* (merge-pathnames nil)
debugger invoked on a TYPE-ERROR in thread
#<THREAD "main thread" RUNNING {10010B0523}>:
The value
NIL
is not of type
(OR (VECTOR CHARACTER) (VECTOR NIL) BASE-STRING PATHNAME SYNONYM-STREAM
FILE-STREAM)
when binding PATHNAME
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT] Exit debugger, returning to top level.
(MERGE-PATHNAMES NIL 4946604 MERGE-PATHNAMES) [external]
0] :backtrace
Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {10010B0523}>
0: (MERGE-PATHNAMES NIL 4946604 MERGE-PATHNAMES) [external]
1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MERGE-PATHNAMES NIL) #<NULL-LEXENV>)
2: (EVAL (MERGE-PATHNAMES NIL))
3: (INTERACTIVE-EVAL (MERGE-PATHNAMES NIL) :EVAL NIL)
4: (SB-IMPL::REPL-FUN NIL)
5: ((FLET "LAMBDA0" :IN "SYS:SRC;CODE;TOPLEVEL.LISP"))
6: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (FLET "LAMBDA0" :IN "SYS:SRC;CODE;TOPLEVEL.LISP") {96F7CB}>)
7: (SB-IMPL::TOPLEVEL-REPL NIL)
8: (SB-IMPL::TOPLEVEL-INIT)
9: ((FLET SB-UNIX::BODY :IN SAVE-LISP-AND-DIE))
10: ((FLET "WITHOUT-INTERRUPTS-BODY-7" :IN SAVE-LISP-AND-DIE))
11: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))
12: ("foreign function: #x43270B")
13: ("foreign function: #x403F08")
0]
|
|
However, as I wrote common lisp is much nicer in some other respects (as you undoubtedly know). For a few other toy examples let's say I do:
This will cause DIVISION-BY-ZERO 50% of the time. But if that happens one of the possible restarts (also seen above) is just try the same thing again. I can try as many times as necessary to get (/ 1 1). Of course this is a silly example, but realistic cases are not hard to come up: you forgot to copy a file to the right place or the disk is full and you need to make some space before retrying. Or you have a transient network failure etc. Similarly The function sine does not exists, but one of the possible restarts allows me to supply something else instead: If I press 1 and then provide #'sin I'll get (0.84147096 0.9092974 0.14112). But the more fun thing to do is to just implement the missing function there and then. Whilst the debugger window stays active, I can just write my "sine" function in the editor or repl and then retry, e.g. writing (defun sine (x) (sin x)) will give the same result.This is pretty cool, because it means you can start writing some topdown code start running it an incrementally fill in the missing functions you are calling bad haven't yet defined without ever losing your state.