[Openmcl-devel] local special on symbol-macro

Tim Bradshaw tfb at tfeb.org
Mon Oct 19 06:42:19 PDT 2009

On 19 Oct 2009, at 11:55, Tobias C. Rittweiler wrote:

> I think the following
>  (let ((x :special))
>    (declare (special x))
>    (symbol-macrolet ((x :symbol-macro))
>      (values x (locally (declare (special x)) x))))
> should return

I think that too, based on this text in the standard: "The use of  
symbol-macrolet can be shadowed by let. In other words, symbol- 
macrolet only substitutes for occurrences of symbol that would be in  
the scope of a lexical binding of symbol surrounding the forms."

In the case you give, the second reference to X is not in the scope of  
such a lexical binding.

I think the underlying point (which isn't in the standard but I think  
is implied by it) is that symbol macros should behave like lexical  
bindings, and in particular you're not allowed to declare them special.

This also makes sense of the restriction for global symbol macros.   
The only thing a non-binding-affecting SPECIAL declaration can do is  
to let you see a special binding which is shadowed by an inner lexical  

(let ((x 1))
   (declare (special x))
   (let ((x 2))
     (values x (locally (declare (special x))

But for DEFINE-SYMBOL-MACRO there can be no "outer" binding, so the  
only thing a special declaration could apply to is the symbol macro,  
and those are not allowed to be special.


More information about the Openmcl-devel mailing list