[Openmcl-devel] Compiler warnings

Ron Garret ron at flownet.com
Sat Oct 17 10:01:59 UTC 2009


On Oct 16, 2009, at 12:56 PM, Gary Byers wrote:

>
>
> On Fri, 16 Oct 2009, David L. Rager wrote:
>
>> Hi Taoufik,
>>
>> You need to define x to avoid those warnings.
>>
>> (defvar *x* '(a b c))
>>
>> Note that I'm fairly sure that defvar only sets a variable's value
>> upon initialization.  Any subsequent calls to define the same  
>> variable
>> are effectively no-ops.
>
> See also DEFPARAMETER.
>
>>
>> IIRC, I think that if you're in a multi-threaded environment, not
>> defining a variable causes the setf's to be thread-local.
>
> A (special) binding is basically a mapping between a special variable
> name (a symbol) and a value.  One trivial and traditional way to
> establish such a binding is to reserve a word in the symbol for
> its global special value; this word is sometimes referred to as the
> symbol's "value cell", and that binding is sometimes called a "static
> binding".
>
> Things like LET/LET*/LAMBDA can establish new dynamic (and
> thread-local) bindings for special variables.
>
> SETF/SETQ of a special variable always assign to the current thread's
> current binding of that special variable.  The current binding is  
> either
> the most recently established (by LET/LET*/LAMBDA ...) dynamic binding
> or the global static binding if the thread has no dynamic binding.
>
> Things like DEFVAR are usually used at toplevel (in the REPL or in a
> file), and so any assignment that they do usually affects the global,
> static binding.
>
> Back to the original poster's question: in something like:
>
> ? (setq x '(1 2 3))
>
> what exactly is X ?  Let's assume that:
>
> 1) it's not something proclaimed (via DEFCONSTANT) to be the name of
>    a constant
> 2) it's not something proclaimed (via DEFVAR, DEFPARAMETER, or other
>    means) to be the name of a SPECIAL (dynamic) variable.
> 3) it's not a lexical variable established by a surrounding LET/LET*/
>    LAMBDA/... form that establishes lexical bindings.
>
> In portable CL, those are the only well-defined possibilities.

Actually, there's a fourth possibility: X can be a symbol-macro.

rg




More information about the Openmcl-devel mailing list