[Openmcl-devel] Compiler warnings

Raffael Cavallaro raffaelcavallaro at mac.com
Sun Oct 18 10:24:15 PDT 2009


On Oct 18, 2009, at 1:07 PM, Taoufik Dachraoui wrote:

> So in the first then; just before compiling (THE TYPE FORM), if FORM  
> is a valid
> expression and returns valid values, and if the values are of  
> typeTYPE, it seems
> not correct to raise a warning.


The warning being raised is not about the type of the values.
The warning being raised is about x being an *undeclared variable.*

*Read The Actual Warning*

You get *exactly* the same warning whether or not x is of the type  
stated in the "the" form.
In neither case do you *ever* get a warning about the type of x.
You *only* get a warning about x being *undeclared.*

Welcome to Clozure Common Lisp Version 1.4-RC1-r13041M  (DarwinX8664)!
? (setf x 1)
1
? (the integer x)
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable X
1
?

Which gives you *exactly* the same warning as when you get the type of  
x *wrong*:

Welcome to Clozure Common Lisp Version 1.4-RC1-r13041M  (DarwinX8664)!
? (setf x 1)
1
? (the cons x)
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable X
1
? (the double-float x)
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable X
1
? (the vector x)
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable X
1
?

Take away lessons:

1. *Stop using undeclared variables!!!!!!*

2. *Read* what the warning actually says!

3. *Stop thinking that "the" = "check-type"


regards,

Ralph


Raffael Cavallaro
raffaelcavallaro at me.com








More information about the Openmcl-devel mailing list