David Golden <email@example.com> wrote:
| Russell Wallace wrote:
| > Is there any way to just declare an ordinary variable at global scope
| > without making it dynamic?
| Yes and no. They're not in the standard directly.
| There is, however, a way of emulating lexically scoped globals - without
| stepping outside common lisp proper - with symbol-macros. Usually
| referred to as "deflexical" or "deflex" macros.
| e.g. Kent Pitman, 1998,
| Message-ID: <firstname.lastname@example.org>#1/1
| Rob Warnock, 2003,
| Message-ID: <NvednWDvaYM0GbKiXTWcemail@example.com>
And free code here:
p.s. Note to CMUCL users: CMUCL-19d and earlier had a bug in macro
expansion [routine MACROEXPAND-1, file ".../src/code/eval.lisp"] such
that in some cases [e.g., "INCF FOO", but not just "FOO" or "SETF FOO"]
references to symbol macros that had been shadowed by lexical variables
expanded to the symbol macro expansion instead of refering to the lexical
variable. This bug was fixed in the CVS as of Revision 1.43 2006-12-19.
CMUCL-19e and later versions contain that fix. If you are running
CMUCL-19c or -19d, I posted a patch here on 2006-12-18 in article
<URL:news:Y_Cdnbvi_4Ir4RvYnZ2dnUVZ_tunnZ2d@speakeasy.net>. Or you
can just snarf "eval.lisp" from the -19e source tarball.
Rob Warnock <firstname.lastname@example.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607