[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue: DECLARE-TYPE-FREE (Version 9)
- To: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>
- Subject: Re: Issue: DECLARE-TYPE-FREE (Version 9)
- From: masinter.pa@Xerox.COM
- Date: 5 Jan 89 22:14 PST
- Cc: Masinter.PA@Xerox.COM, CL-Cleanup@SAIL.Stanford.EDU
- In-reply-to: Kent M Pitman <KMP@STONY-BROOK.SCRC.Symbolics.COM>'s message of Tue, 3 Jan 89 15:24 EST
The example I keep coming back to is one where it isn't so much that the
local declaration is easy to enforce as it is where it is difficult *not*
to enforce it.
Suppose I have
(defun frob (delta)
(flet ((more (x) (+ x delta)))
;; if you like, put (declare (inline more)) here
(typecase delta
(float (locally (declare (type float delta))
... (more rho ) ... )
((signed-byte 8)
(locally (declare (type (signed-byte 8) delta))
... (more zz) ... )
...)
Even without the inline, it is a common & legal transformation to do inline
substitution on "small" fletted functions. Even though the reference
"delta" in the definition of more isn't within the lexical scope of the
local declaration, it *is* the same delta. While its not impossible to
maintain a separate contour in order to segregate the type declarations, it
seems like unnecessary work, and in fact, the declaration is quite useful
if "more" is inlined.