[comp.lang.lisp] Allegro Common Lisp compiler error

rcbamhl@eutrc3.urc.tue.nl (Marc Heijligers) (12/12/89)

Hello,

I think I have found a compile error in Macintosh Allegro Common Lisp
version 1.2.2. It has to do with the dynamic scope of special variables.
The problem is as follows; I want to share a variable between two functions,
but must not be a global variable. So I do the following:

(defun test ()
   (let ((a 1))
     (declare (special a))
     (test1)))

(defun test1 ()
   (declare (special a))
   (print a))

Calling (test) results in printing 1. This is correct. When I try more than
one variable, I try:

(defun test ()
   (let ((a 1))
     (declare (special a)
              (special b))
     (test1)))

(defun test1 ()
   (declare (special a)
            (special b))
   (print a))

Calling (test) results in an error!! 
> Error: Unbound variable: A . 
> While executing: TEST1

This should not! In Steele the form for declare is (declare {decl-spec}*).
So I assume you can use (special ..) more than once. 

When I try the example above without compiling, it works correct. This
is an error; a program should work interpreted the same way as compiled
(see page 438 of Steele). 

By the way, the following form works correct:

(defun test1 ()
   (declare (special a b))
   (print a))

(defun test ()
   (let ((a 1))
     (declare (special a b))
     (test1)))

By the way, I discovered this problem when trying to port a program made in
Lucid Common Lisp to Allegro Common Lisp. 

I hope I'm not wrong about this error. Anyone any suggestions?

By the way, how much faster will the new version of MACL be?

Marc Heijligers
rcbamhl@eutrc3.urc.tue.nl