I've discovered what appears to be a bug in CLISP's handling of variables
declared special in let forms. Consider this:
(defun f () a)
(let ((a 4))
(declare (special a))
(f))
CLISP complains that the variable A has no value. However, if I compile
the code the correct result 4 is returned. Is this a known issue?
In other cases besides let forms, special declarations work fine in
CLISP even with interpreted code, so this seems a bit strange.
--
- Fredrik Sandstrom ·······@infa.abo.fi http://infa.abo.fi/~fredrik -
Computer Science at Abo Akademi University --
* Fredrik Sandstrom wrote:
> (defun f () a)
> (let ((a 4))
> (declare (special a))
> (f))
> CLISP complains that the variable A has no value. However, if I compile
> the code the correct result 4 is returned. Is this a known issue?
> In other cases besides let forms, special declarations work fine in
> CLISP even with interpreted code, so this seems a bit strange.
You need to declare A special in F as well, or alternatively make a
global declaration that A is special.
--tim
Fredrik Sandstrom wrote: [1999-08-29 16:17 +0000]
> I've discovered what appears to be a bug in CLISP's handling of variables
> declared special in let forms. Consider this:
>
> (defun f () a)
>
> (let ((a 4))
> (declare (special a))
> (f))
>
> CLISP complains that the variable A has no value.
|...|
With the above code, it is in fact undefined what happens, so
this is not a bug with CLISP. To make your code be legal, you
could include a special declaration for A in F as well, or add a
DEFVAR (or DEFPARAMETER or a special declamation) for A before
the two forms (in which case the declaration in the LET form
would become redundant (but not illegal)).
(As you surely know, it is not a bad idea to place asterisks
around the names of special variables.)
Vassil Nikolov. (See header for additional contact information.)
Abaci lignei --- programmatici ferrei.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.