I'm not sure it's a SLIME question.
I'm running debian and have the cmucl-source package installed and I like that it's possible to view these sources from a backtrace. I'd like to do the same with sbcl, but how?
Thanks, Gabor
Gabor Melis mega@hotpop.com writes:
I'm not sure it's a SLIME question.
I don't think it's entirely a SLIME question, but a certain amount of co-operation is probably required.
I'm running debian and have the cmucl-source package installed and I like that it's possible to view these sources from a backtrace. I'd like to do the same with sbcl, but how?
SBCL is compiled such that all of its fasls believe they've been compiled from files in the SYS logical host. That is, for instance, #'+ reports that it was compiled from SYS:SRC;CODE;NUMBERS.LISP, and so on. It should therefore be as simple as untarring the sbcl source somewhere and setting up a translation for the SYS logical host in your ~/.sbclrc (or /etc/sbclrc).
This gets you most of the way there, but there may be confusion ensuing because the system sources are not READable to the running system: package names have changed, and there is a #! readmacro used in the sources that isn't present in the target image. A hacky workaround is to load the "chill.lisp" file from the sbcl sources, but better would be for the SLIME people and the SBCL people (yes, this might mean me) to sit down and work out what is required for this to just work. 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.
Cheers,
Christophe
Christophe Rhodes csr21@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.
Allegro as something called "named readtables" and their ELI recognizes -*- readtable: <name> -*- at the beginning of files; expressions originating form such files are read in the specified readtable. Such a feature could be useful for people who like to use strange syntax.
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.
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
Christophe Rhodes csr21@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
Christophe Rhodes csr21@cam.ac.uk writes:
(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 :-)
I had a brief play this afternoon: loading src/cold/chill.lisp from an sbcl tree, and defining translations for "SYS", is sufficient for interactive development with sbcl. Without chill.lisp, indeed, there are reader errors and package errors aplenty: some thought probably needs to be spent if we want this to work 'out of the box', without the user needing to load chill.lisp.
Cheers,
Christophe
[ I have another plan brewing for neat SLIME stuff: more later when my experimental sbcl has built. ]