[Openmcl-devel] Compiler warnings
greg at clozure.com
Sun Oct 18 15:47:48 UTC 2009
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
>> 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))
>> ? (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)
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.
More information about the Openmcl-devel