[Openmcl-devel] Compiler warnings

Taoufik Dachraoui taoufik.dachraoui at wanadoo.fr
Sun Oct 18 18:19:21 UTC 2009


On Oct 18, 2009, at 8:12 PM, Gary Palter wrote:

>
>
>
> On Oct 18, 2009, at 1:54 PM, Taoufik Dachraoui wrote:
>
>>
>> On Oct 18, 2009, at 7:45 PM, Tim Bradshaw wrote:
>>
>>>
>>> On 18 Oct 2009, at 18:07, Taoufik Dachraoui wrote:
>>>
>>>> n the specs it is said that there is three kinds of variables:
>>>> lexical, dynamic and constant,
>>>> and this is the problem, it seems that the hash on SETF creates a
>>>> variable that is neither
>>>> lexical, nor dynamic nor constant (as show in previous
>>>> submissions); So the question
>>>> is what is the rational behind this hack? why the hack did not
>>>> create a dynamic variable as in CMUCL?
>>>
>>> One of the most annoying things about SETF at the top-level in CMUCL
>>> is that it does (or did) effectively declare the name as special.
>>> That can have fairly pervasive and unfortunate side-effects.
>>>
>>> So it's a good thing it does not do this in CCL.
>>>
>> At the price of having a fourth kind of symbol, but this is not a big
>> issue.
>
> SETF does not create a symbol.  And there is certainly not a fourth  
> type of symbol involved.
>
Forgive my wording; I should have said a binding of X in the global  
environment.

> You are being confused, still, by the evaluator vs. compiler  
> generating warnings.
>
Not anymore, my concerns was not about the compiler, I just wanted to  
understand
why the compiler is raising an error, because I was thinking that X is  
a newly create
symbol after running (setf x 1) at top-level, but I was mistaken;  
actually SETF binds
the symbol X to 1 in the global environment, and X is neither dynamic,  
nor lexical
nor constant and this is why the compiler complains.

As a beginner how do I guess the behavior of SETF when I learned from  
the specs
that there is three kinds of symbols: dynamic, lexical and constant.

But the (SETF X 1) in CCL does not create a dynamic variable as in  
CMUCL and this is
the source of my confusion.

Thank you all

Taoufik


> Take the form, put it in a file and compile the file.  You'll get a  
> warning that X is not declared.
>
> [palter at Traveller ~](2)$ cat /tmp/foo.lisp
> (setf x 1)
> [palter at Traveller ~](3)$ dx86cl
> Welcome to Clozure Common Lisp Version 1.4-dev-r13020M-trunk   
> (DarwinX8632)!
> ? (compile-file "/tmp/foo.lisp")
> ;Compiler warnings for "/tmp/foo.lisp" :
> ;   In an anonymous lambda form at position 0: Undeclared free  
> variable X
> #P"/private/tmp/foo.dx32fsl"
> T
> T
> ? (load "/tmp/foo")
> #P"/private/tmp/foo.dx32fsl"
> ? x
> 1
>
>>
>> All this discussions could be avoided if SETF raises an error when
>> trying to bind a non
>> existing symbol (it is fortunate to me because I learned a little  
>> more
>> of CCL now and I
>> practicied my dormant english).
>>
>>
>> Taoufik
>>
>>
>>
>> _______________________________________________
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
>> http://clozure.com/mailman/listinfo/openmcl-devel
>
>






More information about the Openmcl-devel mailing list