[Openmcl-devel] Compiler warnings

Ron Garret ron at flownet.com
Sun Oct 18 11:19:25 UTC 2009


On Oct 18, 2009, at 4:05 AM, Taoufik Dachraoui wrote:

> Sorry but I have to insist.
>

Insist all you want.  That won't make you right.

> In the CL specs
>
> "the specifies that the values[1a] returned by form are of the types  
> specified by value-type.
> The consequences are undefined if any result is not of the declared  
> type."
>
> It is clear that (THE type expr)  specifies the the returned value  
> of expr is of type type.
>

No, this is not clear.  The only thing that is clear is just what it  
says, that if the result is not of the declared type then the  
consequences are undefined.  In CCL, for example:

? (the fixnum 1.2)
;Compiler warnings :
;   In an anonymous lambda form: Type declarations violated in (THE  
FIXNUM 1.2)
1.2

But this is a red herring.  None of this has anything to do with the  
warning you are seeing.

> Again the example:
>
> ? (setf z 1)
> 1
> ? (the fixnum z)
> ;Compiler warnings :
> ;   In an anonymous lambda form: Undeclared free variable Z
> 1
> ? z
> 1
> ? (the fixnum 1)
> 1
> ?
>
> As you can see, after the SETF z has a value of 1 and (THE fixnum 1)  
> does not raise a
> warning but  (THE fixnum z) does, this means to me that the THE  
> operator does not
> merely uses the returned value of z but has something too say about  
> z, and this is wrong
> I believe.

The exact same thing happens with other operators:

? (setf x 1)
1
? ((lambda () x))
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable X
1
? ((lambda () 1))
1
? (let ((y x)) y)
;Compiler warnings :
;   In an anonymous lambda form: Undeclared free variable X
1
? (let ((y 1)) y)
1


It has nothing to do with THE, it has to do with whether a reference  
to an undeclared free variable is passed to the compiler, which is  
what generates these warnings.  Again: this has nothing to do with THE  
-- except insofar as THE is one construct (among many) that causes the  
compiler to be invoked.

rg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20091018/7e7646a3/attachment.html>


More information about the Openmcl-devel mailing list