[Ecls-list] bug in safe-eval?

Nils Bruin nbruin at cecm.sfu.ca
Sat Sep 12 05:38:45 UTC 2009

Does si::safe-eval do what it is supposed to do?


> (si::safe-eval '10 nil 100)

> (si::safe-eval '10 nil)


--- I think the problem is in top.lsp:
I'm not very good at reading LISP, so I may interpret the code wrong, but:

(defun safe-eval (form env &optional (err-value nil err-value-p))
   (let ((output nil) (ok nil))
          (if err-value-p
              (let ((*break-enable* nil))
                (si::eval-with-env form env))
              (handler-bind ((serious-condition #'invoke-debugger))
                (setf output (si::eval-with-env form env)
                      ok t)))
       (return-from safe-eval (if ok output err-value)))))

so it looks to me that if err-value-p is true (i.e., err-value is 
supplied), then "ok" never gets set to t.

More information about the ecl-devel mailing list