From: Richard M K. <kr...@pr...> - 2008-11-03 14:45:02
|
"Jerry James" writes: > I'm still working on a port of PVS (http://pvs.csl.sri.com/) to SBCL. > Almost everything works, but I'm having a little trouble with the > pretty printer in one place. The basic problem is that this code: > > (with-output-to-string (string) > (write '("some string") :stream string :pretty nil :pprint-dispatch nil)) > > works on the existing PVS ports (Allegro and CMU Lisp), but on SBCL > 1.0.21 (x86_64) does this: > > debugger invoked on a TYPE-ERROR in thread #<THREAD "initial thread" > RUNNING {100270FAC1}>: > The value NIL is not of type SB-PRETTY:PPRINT-DISPATCH-TABLE. > > 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. > > > The code in question is inside a pretty-printing function, and is > trying to use a nil pprint-dispatch-table to avoid infinite recursion. The dictionary entry for WRITE says that the PPRINT-DISPATCH argument must be a pprint dispatch table, and NIL isn't one, so that call is arguably not conforming. (The actual culprit is that SBCL declares the type of *PRINT-PPRINT-DISPATCH* to be a pprint dispatch table, and so errors if you try binding the variable to something that isn't one, and WRITE binds printer control variables.) Since you're supplying an explicit PRETTY NIL, the pprint dispatch table shouldn't be used, so leaving out the PPRINT-DISPATCH argument or supplying any pprint dispatch table ought to do the trick. (If you're worried about not bottoming out in case something rebinds *PRINT-PRETTY* to true, you might try supplying a copy of the initial pprint dispatch table.) -- Richard |