Subject: Re: lambda-returning defmacro, capture
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 14 Dec 2006 22:56:29 -0600
Newsgroups: comp.lang.lisp
Message-ID: <WpKdnUir3uZgtx_YnZ2dnUVZ_o2vnZ2d@speakeasy.net>
Andreas Thiele <noreader@nospam.com> wrote:
+---------------
| <to9sn2r02@sneakemail.com> schrieb:
| > What's the correct way to define a global without getting dynamic
| > scope, or SBCL warnings?
...
| I am not 100% sure but I think all global variables are special, meaning
| dynamic. I think this has to to with their environment. 
| Helpful might be:
|    http://www.flownet.com/gat/specials.pdf
+---------------

Also helpful is KMP's writeup of "FAILED Issue PROCLAIM-LEXICAL"
(a reference to which is found in Ron's excellent little paper above):

    http://www.nhplace.com/kent/CL/Issues/proclaim-lexical.html

The CL committee struggled over if/how to add "global lexicals"
and, in the end, simply punted. Actually, they *did* provide one out,
the DEFINE-SYMBOL-MACRO macro, which can be used to provide the
*appearance* of global lexicals, see:

    http://www.alu.org/HyperSpec/Body/03_abaa.htm
    3.1.2.1.1 Symbols as Forms

    http://www.alu.org/HyperSpec/Body/m_defi_1.htm#define-symbol-macro
    Macro DEFINE-SYMBOL-MACRO
    ...
    A binding for a symbol macro can be shadowed by
    LET or SYMBOL-MACROLET.

    http://www.alu.org/HyperSpec/Issues/iss198_w.htm
    Issue ISO-COMPATIBILITY Writeup
    ...
    Rationale:
    ...
      1. DEFINE-SYMBOL-MACRO can be used to define global lexicals,
      by having a global lexical be a symbol macro that expands
      into a reference to a globally allocated cell that is not
      subject to dynamic binding.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607