logo       

Re: SBCL build, MAKE-LOAD-FORM, buglets: msg#00103

lisp.clisp.general

Subject: Re: SBCL build, MAKE-LOAD-FORM, buglets

Sam Steingold <sds@xxxxxxx> writes:

> please try the appended patch.

[ and on clisp-devel CVS digest: ]
> Log Message:
> (mlf-unquote): removed (use SUBLIS instead)

Oh, damn, I was about to tell you that the patch you sent me didn't
work (specifically, caused failure modes in sbcl's build) :-/

However, let me mix in some good news with the bad: with a lightly
frobbed version of MLF-UNQUOTE (and nothing else unchanged in
loadform.lisp) and a fix to defmacro.lisp, the version of clisp I have
now successfully compiles SBCL. (well, more or less; there are some
residual bugs that I haven't yet sorted out, but it's basically
there).

So. Here's what I have for MLF-UNQUOTE:

(defun mlf-unquote (var form)
;; replace '(... var ...) with `(... ,var ...)
;; (setq v 10)
;; (mlf-unquote 'v ''(1 (2 (b c) v d (a)))) ==>
;; (LIST 1 (LIST 2 '(B C) V 'D '(A)))
(cond ((atom form) form)
((eq (car form) 'quote)
(labels ((find-var (tree)
(if (atom tree) (eq var tree)
(or (find-var (car tree)) (find-var (cdr tree)))))
(unquote (form)
(if (consp form)
(if (find-var form)
(cons 'list (mapcar #'unquote form))
(list 'quote form))
(if (eq form var) form
(list 'quote form)))))
(unquote (cadr form))))
(t (cons (mlf-unquote var (car form))
(mlf-unquote var (cdr form))))))

My reasoning is that the call to CONSTANTP looked like it really
wanted to be a call to a putative SELF-EVALUATING-P, and as such was
performing a very light optimization. I don't know if what I have now
is equivalent to what you have (in a sense, I'm scared to cvs upgrade
as I chase the residual bugs :-) but that's what I have that seems to
work. The version with the patch you sent me blows up with an error
of the form
*** SYSTEM:%STRUCTURE-REF: #:G1234 is not of type LAYOUT
(I forget the exact wording, but it was definitely a manifestation of
insufficient evaluation at some stage).

Also, please find attached a hacky patch to defmacro.lisp. The
symptom it cures is:
(defmacro foo (&key (b t)) (if b 'c 'd))
(macroexpand '(foo)) -> C
(macroexpand '(foo :b nil)) -> C ; should be D
but you will want to replace the :%magic keyword with a fresh cons or
a gensym or some other object that can't appear in an argument list.
I hope that the general idea is clear, anyway. Oh, and I may not be
getting it right with multiple evaluation -- that may be something
else to check.

Attachment: clisp-defmacro.diff
Description: defmacro/getf fix


Many thanks,

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)
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise