Subject: Re: symbol-value returns lexical value?
From: (Rob Warnock)
Date: Wed, 25 Apr 2007 05:16:18 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
Kent M Pitman  <> wrote:
| I tried to get global lexicals into the language, but the attempt failed.
| See info on failed X3J13 issue PROCLAIM-LEXICAL at 
| There's no provision for it in the language, but it's an easy user
| program to write.  DEFINE-SYMBOL-MACRO is the operator you need,
| and you can google for prior discussion on how to set it up.

Here's a version I posted just a few months ago:

    (defmacro deflex (var val &optional (doc nil docp))    
      (let ((backing-var (intern (concatenate 'string
					      (symbol-name '#:*deflex-var-)
					      (symbol-name var)
					      (symbol-name '#:*))
				 (symbol-package var))))
	   (defparameter ,backing-var ,val ,doc)
	   ,@(when docp `((setf (documentation ',var 'variable) ,doc)))
	   (define-symbol-macro ,var ,backing-var))))


p.s. Reminder: If you're running CMUCL-19c or earlier, you will
need the path to MACROEXPAND-1 that I posted on 2006-12-18
[Message-ID: <>]
or you will have problems with SETF expanders which reference
DEFLEX'd variable names.

Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607