Cyrus Harmon | 27 Jan 22:41 2011

named-readtables/SLIME interaction problem


I ran into a problem with SLIME where I was getting errors the second time I would compile a buffer with
contents such as the following:

(cl:eval-when (:compile-toplevel :load-toplevel :execute)
 (ql:quickload 'named-readtables))

(defpackage #:reader-macro-test
  (:use #:cl))

(in-package #:reader-macro-test)

(eval-when (:compile-toplevel :load-toplevel :execute)
  (named-readtables:defreadtable readtable-test
    (:merge :standard)))

(named-readtables:in-readtable readtable-test)

It turns out that the problem has to do with the way SLIME deals with the style-warning that the defreadtable
gives about overwriting the existing readtable. The defreadtable form clears out the bindings for the
existing reader, then issues the warning. SLIME parses the buffer and picks up that we're in the
#:reader-macro-test package and sets *readtable* to be the readtable that we've just clobbered and then
in SLIMEs error/warning handling code it further frobs (a copy of) the (now empty-ish) readtable and then
attempts to read using that readtable and fails.

Tobias rightly points out that SLIME should have better support for named-readtables. It also seems to me
that SLIME might want to make greater assurances about the state of the reader in its error handling code.

But the simple, expedient fix is:

(Continue reading)


Gmane