[movitz-devel] bug report

Alessio Stalla axcd at libero.it
Wed Aug 18 12:30:26 UTC 2004

I forgot to mention that I think I have discovered two bugs in movitz:

1) the way setq is implemented in muerte, it always assigns values to special variables, so that e.g.

       (let ((x 5)) (setq x 6))

doesn't do what one might expect. If I've understood correctly how the thing works, the function eval-setq in muerte/eval.lisp should be corrected in:

(defun eval-setq (form env)
  (do* ((p (cdr form) (cddr p))
        (value nil))
      ((null p) value)
    (assert (cdr p) (form)
      "Odd number of arguments to setq: ~W" form)
    (setf value
      (let ((local-var (find (car p) env :key #'car))
	    (form-value (eval-form (cadr p) env)))
        (if local-var
         (setf (cdr local-var) form-value)
         (set (car p) form-value))))))

A similar correction should be applied to eval-setf.

2) This is probably harder to notice: under certain conditions, labels and flet do not properly capture bindings: I was trying to movitz-compile this defun

(defun my-test-labels (x)
  (labels ((p () (print x))
           (q (y) (list x y)))

but it gave me this error:

The slot MOVITZ::REFERENCE-SLOT is unbound in the object

after tinkering a while with this piece of code I found that the bug is probably caused by q being defined but not called/used in some way, in fact if I remove its definition or call it inside the labels it compiles without problems. Now this may not be a real bug because actually defining a function without using it hasn't much sense, nevertheless people should know of its existence because it made me waste a lot of time trying to figure out what caused it :(


More information about the movitz-devel mailing list