Hi,
Attached is a (probably corrupt, sorry) patch which partly implements DWIM when slime commands are executed on sbcl sources.
The background: for those who do not know the detail, suffice it to say that, out of the box, sbcl sources are unreadable (in the READ sense) to a running sbcl. The unreadability comes in two forms: firstly, all of the package names are different (this enables sbcl to build cleanly even from itself); secondly, the #! reader macro (reserved to the user) is used extensively by the sources to implement reader conditionals against the *features* that will be active under the to-be-built lisp.
This patch uses knowledge of sbcl internals (some of which should probably be in sb-introspect; they'll get moved there once we establish exactly what we need) to, firstly, modify the behaviour of FIND-PACKAGE to treat SB!FOO as a nickname for SB-FOO; and secondly, to temporarily replace the current readtable with one which includes a #! reader macro. This, I think, is good enough for a DWIM system; it gets about 99% of sbcl sources right.
My implementation of it is, of course, sucky. I don't really have a handle on the package discipline, nor where a feature like this logically belongs in slime -- it seems to cross-cut several layers. On top of this, I'm fairly sure I haven't found all the places where this is necessary: essentially all places that could do READ need to be wrapped. [ The implementation of the #! reader macro logically belongs in sb-introspect, I think, but it isn't there yet. ]
I hope this patch gives enough of a flavour for what is necessary, and enough information to either desuckify it for me, or to tell me what I should do to make it suck less.
Cheers,
Christophe
Just a quick question. For SBCL hacking, wouldn't it be enough to set the global readtable manually? and perhaps advicing find-package?
Helmut.
Helmut Eller e9626484@stud3.tuwien.ac.at writes:
Just a quick question. For SBCL hacking, wouldn't it be enough to set the global readtable manually? and perhaps advicing find-package?
If that's all you're doing, probably. (FIND-PACKAGE certainly needs to be advised somehow, or else nicknames need to be added to the existing packages). I don't know how much you are willing to cater for the possibility of people working on more than just sbcl in the same slime session, though -- consider the possible confusing bug reports (though this of course cuts both ways...)
Cheers,
Christophe