Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!inuxc!iubugs!iuvax!dyb From: dyb@iuvax.UUCP Newsgroups: net.lang.lisp Subject: Re: Re: Lexically scoped variables in co Message-ID: <5800013@iuvax.UUCP> Date: Sun, 6-Jul-86 21:31:00 EDT Article-I.D.: iuvax.5800013 Posted: Sun Jul 6 21:31:00 1986 Date-Received: Thu, 10-Jul-86 04:51:29 EDT References: <587@bcsaic.UUCP> Lines: 23 Nf-ID: #R:bcsaic:-58700:iuvax:5800013:000:971 Nf-From: iuvax!dyb Jul 6 20:31:00 1986 >Since my original posting I have discovered that despite what the >compiler claims in its warning, free references are not compiled as >special variables after all! For example if I do: > >(defun a () (print x)) >(defun b () (let ((x 10)) (a))) >(setq x 5) > >and compile all this, the compiler says that in function A, X is >unknown and has been declared special (i.e. X will be dynamically >scoped. (I should mention that this is all with respect to a Symbolics >3600 machine.) If the compiler warning were accurate then the >expression (b) should return 10. However, it in fact returns 5, which >tells me that X is being lexically scoped. Note that if I start with >(defvar x 5) then (b) does return 10. My guess is that the compiler >warning is an obsolete relic from version 5. > >LSB Try (defun b () (let ((x 10)) (declare (special x)) (a))) and see what happens. As you currently have it, the x in b is lexically scoped and is therefore not visible in a.