[slime-devel] Re: [Sbcl-devel] Problem with SBCL, Slime, and infix.lisp (gack!)

Brian Downing bdowning at lavos.net
Sun Apr 10 04:03:46 UTC 2005


On Sat, Apr 09, 2005 at 10:07:13PM -0500, Brian Downing wrote:
> I think this is an SBCL problem (as it doesn't happen in CMUCL), but
> Slime code tickles it so I'm sending it to both lists.

It turns out it's a problem with infix.  It called READ internally
inside its main reader macro.  However, it didn't rebind *read-suppress*
inside, so it's internals got all mucked up with SBCL's (correct)
behavior in this regard.

I see a commit for CMUCL's reader in one of the latest snapshots that
mimics the SBCL behavior, so I imagine it would behave the same way with
unmodified infix.

Attached is a patch for infix, if anybody cares.  It rebinds
*read-suppress* to nil inside infix-reader, so the whole infix
expression is parsed (and then ignored, since *read-suppress* is t
outside).

-bcd
-------------- next part --------------
--- infix.cl	1996-06-28 13:03:32.000000000 -0500
+++ infix.lisp	2005-04-09 22:57:03.786077368 -0500
@@ -294,20 +294,21 @@
 (defun infix-reader (stream subchar arg)
   ;; Read either #I(...) or #I"..."
   (declare (ignore arg subchar))
-  (let ((first-char (peek-char nil stream t nil t)))
-    (cond ((char= first-char #\space)
-	   (read-char stream)		; skip over whitespace
-	   (infix-reader stream nil nil))
-	  ((char= first-char #\")
-	   ;; Read double-quote-delimited infix expressions.
-	   (string->prefix (read stream t nil t)))
-	  ((char= first-char #\()
-	   (read-char stream)		; get rid of opening left parenthesis
-	   (let ((*readtable* *infix-readtable*)
-		 (*normal-readtable* *readtable*))
-	     (read-infix stream)))
-	  (t
-	   (infix-error "Infix expression starts with ~A" first-char)))))
+  (let ((*read-suppress* nil))
+    (let ((first-char (peek-char nil stream t nil t)))
+      (cond ((char= first-char #\space)
+             (read-char stream)         ; skip over whitespace
+             (infix-reader stream nil nil))
+            ((char= first-char #\")
+             ;; Read double-quote-delimited infix expressions.
+             (string->prefix (read stream t nil t)))
+            ((char= first-char #\()
+             (read-char stream)  ; get rid of opening left parenthesis
+             (let ((*readtable* *infix-readtable*)
+                   (*normal-readtable* *readtable*))
+               (read-infix stream)))
+            (t
+             (infix-error "Infix expression starts with ~A" first-char))))))
 
 (set-dispatch-macro-character #\# #\I #'infix-reader *readtable*) ; was #\# #\$
 


More information about the slime-devel mailing list