Re: Another spurious compilation diagnostic?
Steven Edwards <[email protected]>
| Newsgroups | gmane.lisp.cmucl.general |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your assistance. It looks like you are correct. However, while the compiler may be smart, it's not smart enough to see that there's a secondary guard variable that prevents any access of the list-length result if the argument is nil. The same goes for the when evaluation. == Steven On Sep 23, 2008, at 2:12 AM, Madhu wrote: > [pardon the top post, if you find it inappropriate] > > The CLHS entry for LIST-LENGTH says: > > ,---- > | Returns the length of list if list is a proper list. Returns nil if > | list is a circular list. > `---- > > This means one of the possible return values is NIL. The compiler > diagnostics seem to indicate that it has inferred that the value > returned by LIST-LENGTH are used only in number contexts. > > The compiler is warning you that there will be an error in the event > LIST-LENGTH returns NIL. > > I suspect the case with the other diagnostic is similar. It is likely > you are using the return value of a (WHEN clause) where the compiler > always expects a number. > > Both of these deal with the specifics of your code , so it is likely > the compiler knows better (as it has access to the code) than us (who > dont:)