Comment 7 for bug 573747

Revision history for this message
Christophe Rhodes (csr21-cantab) wrote : Re: [Bug 573747] Re: non-standard attempts to evaluate declarations

 status confirmed
 importance wishlist

Roman Marynchak <email address hidden> writes:

> You are right, I have entered that garbage in REPL intentionally,
> because I saw in compiler sources (src/code/eval.lisp) this code
>
> (defun %simple-eval (expr lexenv)
> (let* (;; why PROGN? So that attempts to eval free declarations
> ;; signal errors rather than return NIL. -- CSR, 2007-05-01
> (lambda `(lambda ()
> (declare (muffle-conditions compiler-note))
> (progn ,expr)))
> (fun (sb!c:compile-in-lexenv nil lambda lexenv)))
> (funcall fun)))
>
> This trick is not CLHS-compliant.

Yes it is.

> Just because "In situations where such expressions can appear,
> explicit checks are made for their presence and they are never
> actually evaluated".

Within a PROGN, or at the REPL, is not a situation where such (DECLARE)
expressions can appear. A better error message in situations where
declare expressions are not legal might be desireable, but sbcl's
current behaviour on free declarations is allowed by the standard.

Christophe