[Openmcl-devel] Compiler warnings

Taoufik Dachraoui taoufik.dachraoui at wanadoo.fr
Sun Oct 18 08:30:15 PDT 2009

On Oct 18, 2009, at 4:54 PM, Greg Pfeil wrote:

> [bringing back to the list, as I forgot to CC them on my last message]
> On 18 Oct 2009, at 9:58, Taoufik Dachraoui wrote:
>> In our example:
>> (setf x 1)
>> (THE fixnum x)
>> The form x returns 1 and the type of 1 is fixnum thus I do not  
>> understand why the compiler
>> raise a warning; Suppose that the compiler raises an error instead  
>> of a warning
>> stating that the x is an undeclared free variable; this may be  
>> reasonable but it is not
>> compliant with the standard.
> Perhaps if I show you an analogous example at eval-time (as opposed  
> to compile-time) you will see how the warning that is signaled has  
> nothing to do with THE.
> ? (defun the* (type expr)
>    (declare (ignore type))
>    expr)
> THE*
> ? (the* 'fixnum x)
> > Error: Unbound variable: X
> Would you say here that THE* is signaling the error? The function  
> THE* has not yet been called at the point of the error. The error  
> exists merely because the form has the undeclared (and thus unbound)  
> variable X in it.

? (setf x 1)
? (defun the* (type expr)
    (declare (ignore type))
? (the* 'fixnum x)

So here you see you do not get an error (you just forgot to setf x)

> With (the fixnum x) a similar thing is happening at compile time.
>> Please bear with I may be mistaken, but as far as I can see and  
>> understand, this issue looks
>> serious.
> Here is the real issue: you think it is possible that you are _not_  
> mistaken. The people you are conversing with on the list have each  
> been dealing with the spec since it was written. They are legion and  
> they are all in agreement that you are wrong. What you should do is  
> accept that you are wrong, and work on figuring out what your  
> misunderstanding is. As long as you maintain that you may be  
> correct, you will have a hard time seeing why you are not.

I respect all of you and I recognize that I am far from being a lisp  
guru, and consider my self
lucky to be able to discuss things in this site. I learned a great  
deal of things thanks to you all.

But I have to confess, I am still not convinced, and I think that the  
THE operator is not
conformant to the specs [according to the spec THE should compare the  
specified type
with the type of the returned value of the form]; please forget about  
previous submissions
because there is some confusions about if warning is necessary or not.

Also, look how SETF in CMUCL and CCL are behaving differently as is  
shown below:

 >>> cmucl
* (setf d 2)

Warning:  Declaring D special.

* (defun f () (+ 1 d))

* (let ((d 5)) (f))

 >>>>  d is dynamic; at call time f uses the last d value >>>>>

 >>> openmcl
? (setf d 2)
? (defun f () (+ 1 d))
;Compiler warnings :
;   In F: Undeclared free variable D
? (let ((d 5)) (f))
;Compiler warnings :
;   In an anonymous lambda form: Unused lexical variable D

 >>>>> d is lexical; within f d is bound to the lexical value 2 at  
definition time

This shows that setf is implemented differently; maybe it is  
interesting to compare
this with other implementations.


More information about the Openmcl-devel mailing list