[Openmcl-devel] local special on symbol-macro

Tobias C. Rittweiler tcr at freebits.de
Mon Oct 19 03:55:20 PDT 2009


I think the following

  (let ((x :special))
    (declare (special x))
    (symbol-macrolet ((x :symbol-macro))
      (values x (locally (declare (special x)) x))))

should return

  :SYMBOL-MACRO, :SPECIAL

It currently returns

  :SYMBOL-MACRO, :SYMBOL-MACRO

SBCL and CLISP return :SYMBOL-MACRO, :SPECIAL, while others signal an
error. I think, signalling an error is a mistake, and I'll mention this
issue to those implementations.

The reasoning why I think :SYMBOL-MACRO, :SPECIAL is the correct
implementation (and erroring is not) is mostly because

  http://www.lispworks.com/documentation/HyperSpec/Issues/iss228_w.htm

says so. I couldn't find it spelled out as explicitly in the spec
itself. Perhaps you're more lucky than me.


There's some inconsistency at place here, though, because
the definition of DEFINE-SYMBOL-MACRO explicitly forbids declaring a
global symbol macro to be special.

So the following _should_ signal an error:

  (progn (define-symbol-macro .foo. :global-symbol-macro)
         (locally (declare (special .foo.)) .foo.))  

(CCL returns :GLOBAL-SYMBOL-MACRO)

or

  (progn (define-symbol-macro .foo. :global-symbol-macro)
         (proclaim '(special .foo.)))

On the other hand,

    (progn (define-symbol-macro .foo. :global-symbol-macro)
           (let ((.foo. :special))
             (declare (special .foo.))
             (values .foo.
                     (let ((.foo. :lexical))
                       (locally (declare (special .foo.)))))))

should _not_ signal an error, but return :SPECIAL, :SPECIAL.

  -T.





More information about the Openmcl-devel mailing list