🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.lisp
Article #646

Re: Re: Lexically scoped variables in co

#646
From: dyb
Date: Mon, 07 Jul 1986 01:31
23 lines
1529 bytes
>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.
Technical Details
Message-ID: <5800013@iuvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!cbosgd!ihnp4!inuxc!iubugs!iuvax!dyb
References: <587@bcsaic.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!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