[slime-devel] broken clojure REPL

Terje Norderhaug terje at in-progress.com
Fri Jan 15 17:40:31 UTC 2010

On Jan 14, 2010, at 12:35 AM, Michael Weber wrote:
> On Jan 14, 2010, at 01:11 , Terje Norderhaug wrote:
>> Shouldn't we allow the empty list "()" ?
> Or the (very useful) symbol '0+ ...
> I understand SIMPLE-READ mostly to be a straw-man, FWIW.  When  
> you're finished plugging all the holes it will be BIG-HAIRY-READ... ;)

No, I think it already is fine as definition of the simple syntax to  
use for swank messages passed between the client and server. We  
should not make it big and hairy in an attempt to cover all the  
variety in Lisp. I still think the protocol should provide a way to  
escape characters in symbols so we can use them freely, but that's  
pretty much it:

(defun read-swank ()
   (let ((c (read-char)))
     (case c
       (#\" (with-output-to-string (*standard-output*)
              (loop for c = (read-char) do
                    (case c
                      (#\" (return))
                      (#\\ (write-char (read-char)))
                      (t (write-char c))))))
       (#\( (loop collect (simple-read)
                  while (ecase (read-char)
                          (#\) nil)
                          (#\space t))))
       (#\' `(quote ,(simple-read)))
       (t (let ((string (with-output-to-string (*standard-output*)
                          (loop for ch = c then (read-char nil nil) do
                                (case ch
                                  ((nil) (return))
                                  (#\\ (write-char (read-char)))
                                  ((#\space #\)) (unread-char ch)  
                                  (t (write-char ch)))))))
            (cond ((digit-char-p c) (parse-integer string))
                  ((intern string))))))))

-- Terje Norderhaug
   terje at in-progress.com

More information about the slime-devel mailing list