title: SBCL Error Messages: Any way to improve?
body: <p>I've been developing with Common Lisp for almost a year now, and this is really starting to get on my nerves. I started programming CL using CLISP, but I later switched over to SBCL for speed. I do a lot of rather low-level stuff, so I need to interface with a lot of C code. I really like the incremental development aspect of CL (I don't use Emacs however - I'm running SLIMV in Vim), but I find myself developing more slowly than I would in Python, Perl, C, or even NASM. The root of the problem lies in SBCL's error messages. I once was forced to search through almost 500 lines of code because SBCL decided to give me an <code>ERROR: Invalid number of arguments on foreign function #&lt; some memory address &gt;</code>. No designation of what function was called, no line number, nothing. More recently, I've had the delight of getting <code>The loaded code expects an incompatible layout for class SB-PRETTY:PRETTY-STREAM.</code> randomly. The code runs FINE on CLISP, but just fails with obscure errors on SBCL. Is there any way to make these messages somewhat more informative? I've been writing C and assembly for almost 6 years now, and even they will give you a line number. The only halfway reasonable SBCL errors I've seen have been reader errors, which are almost useless because they usually amount to a missing parenthesis. Again, is there any declaration/command line switch that can be used to change this? I'd even be okay with writing my own error printer at this point.</p>
  
  <p>EDIT:
  An example, with <code>(sb-ext:restrict-compiler-policy 'debug 3)</code> in my ~/.sbclrc (using --load rather than --script so .sbclrc is loaded)</p>
  
  <pre><code>debugger invoked on a SB-INT:SIMPLE-PROGRAM-ERROR in thread
  #&lt;THREAD "main thread" RUNNING {AB09931}&gt;:
    invalid number of arguments: 0
  
  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.
  
  (SB-KERNEL::INVALID-ARG-COUNT-ERROR-HANDLER
   #&lt;unavailable argument&gt;
   #.(SB-SYS:INT-SAP #XB78CDAE0)
   #&lt;SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB78CD7DC :TYPE (*
                                                           (STRUCT
                                                            SB-VM::OS-CONTEXT-T-STRUCT))&gt;
   (79))
  0] print
  (SB-KERNEL::INVALID-ARG-COUNT-ERROR-HANDLER
      #&lt;unavailable argument&gt;
      #.(SB-SYS:INT-SAP #XB78CDAE0)
      #&lt;SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB78CD7DC :TYPE (*
                                                              (STRUCT
                                                               SB-VM::OS-CONTEXT-T-STRUCT))&gt;
      (79))
  0] down
  (SB-KERNEL:INTERNAL-ERROR
      #.(SB-SYS:INT-SAP #XB78CD7DC)
      #&lt;unavailable argument&gt;)
  1] down
  ("foreign function: #x805FCBB")
  2] down
  
  Bottom of stack.
  </code></pre>
  
  <p>Not exactly informative.</p>