[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FLET & declarations
Date: Mon 17 Aug 87 03:57:47-EDT
From: GZ%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU
Are 'pervasive' declarations in FLET supposed to apply to the function bodies?
E.g.
(flet ((foo () x)) ;Is this x special?
(declare (special x))
...)
(flet ((foo () (foo) ...)) ;Does this call to (foo) return a fixnum?
(declare (function foo () fixnum))
...)
(flet ((foo () (foo 17))) ;Is (foo 17) inline?
(declare (inline foo))
...)
CLtL does not permit DECLARE to be used in that position (see p.113).
I believe it has been proposed to change that, although I couldn't
find a copy of the proposal in my rather disorganized files. I would
argue that the paragraph in the middle of page 155 of CLtL supports
the position that when this extension is made, the pervasive declarations
should apply to the function bodies.
Note that the FUNCTION declaration used in your middle example is not
pervasive. Since you use FLET rather than LABELS, this declaration
would not apply to the call to FOO within the body of FOO. It's a
different FOO.
The INLINE declaration is said by CLtL to be pervasive, however I
believe that to be a bug since it makes it unclear which of the two
FOOs in your example it refers to. Perhaps it refers to both.
Anyone putting together a proposal to clean up the specification of
declarations in Common Lisp ought to address the issues raised by
your question.