From: Drew McDermott
Subject: Are ftype declarations inferred?
Date: 
Message-ID: <c3fq0l$t5r$1@news.wss.yale.edu>
Suppose I have a function defined thus:

(defun foo (a b)
    (declare (type integer a b))
     ...
    (the string (xxx ...)))

Does this make the following declaration

(declaim (ftype (function (integer integer) string)
                 foo))

redundant?  I mean, does the language definition require the latter 
declaration to follow from the former?  As a somewhat orthogonal 
question, how do various implementations handle this situation?

Put another way, if an 'ftype' declaration _contradicts_ internal 
argument/result declarations, is an implementation required or allowed 
to signal that, and do any of them actually do so?

-- 
                                    -- Drew McDermott
                                       Yale Computer Science Department
From: Alexey Dejneka
Subject: Re: Are ftype declarations inferred?
Date: 
Message-ID: <m3fzc3qyte.fsf@comail.ru>
Drew McDermott <··················@at.yale.dot.edu> writes:

> Suppose I have a function defined thus:
> 
> (defun foo (a b)
>     (declare (type integer a b))
>      ...
>     (the string (xxx ...)))
> 
> Does this make the following declaration
> 
> (declaim (ftype (function (integer integer) string)
>                  foo))
> 
> redundant?

Partially. Ordinary you can redefine FOO and the old inferred type
must be forgotten, but the explicit declaration will be preserved
(there is no UNDECLAIM). But CLHS 3.2.2.3 forbids redefinitions of
individual functions defined in the same file, so propagation of
inferred type inside one file is possible.

> Put another way, if an 'ftype' declaration _contradicts_ internal
> argument/result declarations, is an implementation required or allowed
> to signal that, and do any of them actually do so?

Implementations are not required to check type declarations, but are
allowed. E.g. SBCL signals STYLE-WARNING and ignores global
declaration.

-- 
Regards,
Alexey Dejneka

"Alas, the spheres of truth are less transparent than those of
illusion." -- L.E.J. Brouwer