[slime-devel] Re: sbcl sources
Christophe Rhodes
csr21 at cam.ac.uk
Sat May 22 10:14:17 UTC 2004
Helmut Eller <e9626484 at stud3.tuwien.ac.at> writes:
> Christophe Rhodes <csr21 at cam.ac.uk> writes:
>
>> I posted about this on slime-devel a while ago, about
>> giving a specified restart for packages that look like sb!foo -- I
>> don't remember anything coming of that, though.
>
> Have you a reference to this post? I haven't seen it.
My apologies. It went to sbcl-devel, not slime-devel.
<http://www.caddr.com/macho/archives/sbcl-devel/2003-10/2644.html>
contains the message, but not the patch.
The gist of it, in this context, is to implement find-package
something like
(defun find-package (name)
(let ((result (%real-find-package name)))
(unless result
(if (= (mismatch name "SB!") 3)
(restart-case
(error 'bootstrap-package-not-found :name name)
(debootstrap-package ()
(return-from find-package
(find-package (replace #\! #\- name)))))
(error 'package-not-found :name name)))
result))
and export BOOTSTRAP-PACKAGE-NOT-FOUND and DEBOOTSTRAP-PACKAGE (or
similar). Then systems which want to read sbcl sources can do so by
handling BOOTSTRAP-PACKAGE-NOT-FOUND errors...
> Another, perhaps more convenient, possibility would be to associate
> special readtables with certain packages; before reading, we would
> check if the package has such a readtable and use it instead of the
> current readtable.
... modulo the readtable issues -- but even this is special-casable
for sbcl: all of sbcl's source files which need special readtable
support to be read also contain an (in-package <bootstrap-package>) as
their first non-comment form: so a handler for
BOOTSTRAP-PACKAGE-NOT-FOUND could, in addition to choosing a restart,
set the readtable for the duration of the read of that file.
(defun read-from-file (args)
(let ((*readtable* *readtable*))
(handler-bind ((bootstrap-package-not-found
(lambda (c)
(setq *readtable* *sbcl-bootstrap-readtable*)
(invoke-restart 'debootstrap-package c))))
(do-various-ready/evaly/stuff))))
or something like that.
(I should say that at present I don't use slime in sbcl development,
but I'd like to: if this gets us closer to the ability for me to type
C-c C-c in an sbcl source file and have it at least attempt to work,
count me in :-)
Cheers,
Christophe
--
http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge)
More information about the slime-devel
mailing list