[Openmcl-devel] Compiler warnings

Taoufik Dachraoui taoufik.dachraoui at wanadoo.fr
Sun Oct 18 16:05:43 UTC 2009


On Oct 18, 2009, at 5:47 PM, Greg Pfeil wrote:

>
>
> On 18 Oct 2009, at 11:30, Taoufik Dachraoui wrote:
>
>>
>> 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)
>> 1
>> ? (defun the* (type expr)
>>  (declare (ignore type))
>>  expr)
>> THE*
>> ? (the* 'fixnum x)
>> 1
>> ?
>>
>> So here you see you do not get an error (you just forgot to setf x)
>
> No, I didn't forget to setf x, you missed the point of the example.  
> The point is that a warning/error/whatever can be signaled without  
> it being caused by the outermost form. It is clear (or so I had  
> hoped) in my example that X is evaluated (and signals an error)  
> before (THE* ...) is evaluated.
>
> In a similar fashion, X is compiled (and signals an warning) before  
> (THE ...) is evaluated. IE, the warning that is raised has nothing  
> to do with THE.
>
so (+ x 1) will raise an error? it does not.

Taoufik





More information about the Openmcl-devel mailing list