[Ecls-list] Bug in local macros

Pascal Costanza pc at p-cos.net
Tue Jun 6 07:12:20 UTC 2006


On 5 Jun 2006, at 22:09, Pascal Costanza wrote:

> 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 cases shows that enclosing symbol-macrolet
> definitions only have an effect for interpreted code, and enclosing
> macrolet definitions never have an effect.

The second test case was wrong. Here is a correct one:

 > (defmacro x () 1)
X
 > (defun bar ()
     (macrolet ((x () 2))
       (macrolet ((m () (x)))
         (m))))
BAR
 > (bar)
2
 > (compile 'bar)
[...mumble...]
BAR
NIL
NIL
 > (bar)
1

This means that enclosing macrolet definitions also only apply in  
interpreted, but not in compiled code.


Pascal

-- 
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium








More information about the ecl-devel mailing list