Macrolet bug

Pascal Costanza <[email protected]> Mon, 5 Jun 2006 22:14:57 +0200
Newsgroups gmane.lisp.allegro
Message-ID <[email protected]>
Hi,

There is a bug with local macro definitions in ecl. The HyperSpec  
says this:

"The macro-expansion functions defined by macrolet are defined in the  
lexical environment in which the macrolet form appears. Declarations  
and macrolet and symbol-macrolet definitions affect the local macro  
definitions in a macrolet, [...]."

The following test case shows that an enclosing symbol-macrolet  
definition only has an effect for interpreted code, but not for  
compiled code:

CL-USER(1): (define-symbol-macro x 1)
X
CL-USER(2): (defun foo ()
               (symbol-macrolet ((x 2))
                 (macrolet ((m () x))
                   (m))))
FOO
CL-USER(3): (foo)
2
CL-USER(4): (compile 'foo)
FOO
NIL
NIL
CL-USER(5): (foo)
1

Macrolet, however, is handled correctly:

CL-USER(10): (defmacro x () 1)
X
CL-USER(11): (defun bar ()
                (macrolet ((x () 2))
                  (macrolet ((m () (x)))
                    (m))))
BAR
CL-USER(12): (bar)
2
CL-USER(13): (compile 'bar)
BAR
NIL
NIL
CL-USER(14): (bar)
2

I am using Allegro 8.0.


Cheers,
Pascal

-- 
Pascal Costanza, mailto:[email protected], http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium