[slime-devel] swank-lispworks patch and using slime-repl with Lispworks

Sidney Markowitz sidney at sidney.com
Thu Jan 15 05:31:51 UTC 2009


I posted this information to the Aquamacs-devel list and was asked to
post it here.

I was looking at the bug in the inspector in slime-fancy when used with
clos objects in LispWorks. The bug was reported here quite a while ago
and the latest patch for it was posted in

http://article.gmane.org/gmane.lisp.slime.devel/7415

I won't repost the patch as the one there applies cleanly to current
CVS. All it does is define three one line wrapper functions that are
available in other lisps or their swank backends but not LispWorks and
are used by the fancy inspector for slot write access.

I did confirm that the bug occurs with the current version 5.1 of
LispWorks Personal Edition, using SLIME from CVS. While reproducing it I
found that the existing documentation for SLIME and LispWorks Personal
Edition is no longer accurate, so I am noting what I found here, along
with the steps to reproduce the bug.

LispWorks Personal Edition is the free version that has some
restrictions, including no ability to start it up from the command line
without a GUI (at least on MacOS X, I'm not familiar with it on other
platforms), nor to have it load an init file. That prevents it from
being started up using M-x slime. The workaround is to start up
LispWorks independently and use it as you would any remote lisp with
SLIME by having it run a swank server and have emacs use M-x slime-connect.

SLIME now needs a call to (swank-loader:init) after swank-loader is
loaded and before swank:create-server is called. Using asdf to load
SLIME takes care of that, but the older documented ways for using SLIME
with LispWorks did not mention doing that. LispWorks does not come with
asdf (or at least the free version doesn't).

I got SLIME working with the following steps. Of course some of these
could be automated on using Applescript tricks as Bill Clementson
blogged about in 2004, but these are the underlying steps that make it work:

1. Start up LispWorks and then in it load the swank-loader.lisp file
from the SLIME distribution.

2. Call (swank-loader:init)
Note that if you are putting this into a file that is being loaded you
have to play games like (funcall (find-symbol "INIT" :swank-loader)) or
(funcall (read-from-string "swank-loader:init")) because the
swank-loader package won't be defined yet at read time.

3. Call (swank:create-server) or if you don't want the Lisp to quit when
you quit SLIME call (swank:create-server :dont-close t) The same note
applies about using funcall to get around the package problem if all
this is in a file that you are loading.

4. Emacs should be set up with an initialization file or customization
file that adds SLIME's directory to the load path, does a (require
'slime-autoloads) (setup-slime '(slime-repl))

You can start up emacs either before or after starting up the Lisp and
swank server.

5. After the swank server is running, in emacs use M-x slime-connect to
start up SLIME.

  -----------------------

The bug that is mentioned with a patch in
http://article.gmane.org/gmane.lisp.slime.devel/7415
affects the object inspector that is loaded by slime-fancy. To reproduce
the bug, load up SLIME with (setup-slime '(slime-fancy)) using
Lispworks, evaluate the following in the SLIME REPL

(defclass Submarine ()
  ((Depth)
   (Speed)))

(setq Sub-1 (make-instance 'Submarine))
(setf (slot-value Sub-1 'Depth) 100)

Then use the SLIME menu -> Debugging -> Inspect
and tell it to inspect sub-1

This will produce an error

The slot #<STANDARD-EFFECTIVE-SLOT-DEFINITION DEPTH 2008DC2B> is missing
from #<SUBMARINE 2008D41F> (of class #<STANDARD-CLASS SUBMARINE
2008E68F>), when reading the value.
   [Condition of type CONDITIONS::SLOT-MISSING-ERROR]



The patch does seem to fix the bug. The error does not happen if you use
a different Lisp other than Lispworks (I tried it using sbcl). It also
does not happen if you load slime-repl, whose inspector does not provide
a way to modify the contents of slots, only with the additional slot
functionality in the inspector in slime-fancy.

I was not able to use Lispworks at all without loading some REPL,
whether it was by loading slime-repl or slime-fancy, which prompted my
previous question to the mailing list as to whether there is supposed to
be a way to use SLIME with a remote Lisp without loading slime-repl.

So, is there a maintainer who is willing to commit the patch to
swank-lispworks.lisp?

Thanks,

 Sidney Markowitz
 sidney at sidney.com





More information about the slime-devel mailing list