From: Fredrik Sandstrom
Subject: Special variables in CLISP
Date: 
Message-ID: <g2dy3.167$cM.49@read2.inet.fi>
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              --

From: Tim Bradshaw
Subject: Re: Special variables in CLISP
Date: 
Message-ID: <ey3zozaqova.fsf@lostwithiel.tfeb.org>
* 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
From: Vassil Nikolov
Subject: Re: Special variables in CLISP
Date: 
Message-ID: <l03130300b3ef345bb0ea@195.138.129.111>
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.