Question about declare-top



C Y wrote:

> --- Richard Fateman  wrote:
> 
>>I think the idea is this:
>>
>>If you have programs that are defined within a file F and you use,
>>as global variables   x, y, z,   you might declare them to be
>>"special". But you probably don't want them to be special in other
>>files that are compiled after F.
> 

> dynamic -> globally accessable, and globally reassignable?

Not exactly.  Accessible within the dynamic scope of the name.


> So special -> unspecial would be an attempt to temporarily make
> something globally accessable (during, say a file compile) but then
> revoke that global status after the job is done? 

Yes, I think so.

> Wouldn't something
> like that be better handled with packages?

Maclisp, circa 1966,  did not have packages.
> 

RJF

(defun foo(x)(declare (special x))
   (bar))

(defun bar() x)  ;; since x is special, refers to the DYNAMIC binding of x
(foo 3)  ==> 3

(defun foo1(x) (bar1))
(defun bar1() x)
(foo1 3) ==> error, attempt to take the value of the unbound variable x