Re: Scoping Question
- From: Fred Gilham <gilham@xxxxxxxxxxxxxxxxxxxxxx>
- Date: 12 Nov 2005 11:36:45 -0800
The CMUCL behavior is customizable using the *top-level-auto-declare*
variable.
* (setf *top-level-auto-declare* nil)
NIL
* (setf foo 3)
;
; Warning: This variable is undefined:
; FOO
;
3
* foo
3
*
*TOP-LEVEL-AUTO-DECLARE* is an external symbol in the EXTENSIONS
package.
It is a special variable; its value is :WARN.
WARN is an external symbol in the KEYWORD package.
It is a constant; its value is :WARN.
Special documentation:
This variable controls whether assignments to unknown variables at top-level
(or in any other call to EVAL of SETQ) will implicitly declare the variable
SPECIAL. These values are meaningful:
:WARN -- Print a warning, but declare the variable special (the default.)
T -- Quietly declare the variable special.
NIL -- Never declare the variable, giving warnings on each use.
So set it to "NIL" in your init.lisp.
As far as noobs are concerned, sometimes you have to take a few
lumps....setq or setf at the top level is undefined behavior. I think
many lisp noobs learn the meaning of undefined behavior by stumbling
over this issue, and it certainly brings the issue of what a special
variable is to the forefront.
--
Fred Gilham gilham@xxxxxxxxxxx
I think it's pretty obvious that the worship of that false idol known
as the State has, in the 20th Century, had some very bad effects. The
historians I'm familiar with have settled on the number of dead as 177
million, although I've seen estimates of up to 200 million.
-Bob Wallace
.
- References:
- Scoping Question
- From: Sachin Kamboj
- Re: Scoping Question
- From: Rob Warnock
- Scoping Question
- Prev by Date: Re: Nested &REST parameter vs. single named parameter
- Next by Date: Re: bese continuations
- Previous by thread: Re: Scoping Question
- Next by thread: Mock My Words
- Index(es):
Relevant Pages
|