From: Steve Haflich

Subject: Re: Bug in macrolet?

Date: 1999-7-5 15:27

   To: <cs.berkeley.edu at allegro-cl>
   Subject: Bug in macrolet?
   From: Antonio Leitao <gia.ist.utl.pt at aml>

   I found a little problem in Allegro CL 5.0 (Linux) with interpreted
   code.
   
   In the following definition,
   
   (defun foo (x)
     (macrolet ((bar ()
   	       x))
       (+ x (bar))))
   
   the macrolet form is accessing a variable x which is not accessible at
   the time of the macro expansion.
   
   If I compile the file containing the above definition, I get an error
   during macroexpansion, as expected.  What is not expected is that when
   I run the same example interpreted, I can call foo.
   
   (foo 1) -> 2
   
I believe Allegro behavior conforms to the ANS in this case, both
compiled and interpreted behavior.

It's pretty clear what you _expect_ to happen, but I wonder why you
expect that behavior.  In particular, can you justify your
expectations from the ANS and cite the relevant passages?

   i checked the same example in CMUCL and it implements the expected
   behaviour (but, if I'm not mistaken, in CMUCL the code never runs
   interpreted).

I'm absolutely sure CLUCL behavior is also correct in this regard.