[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Constant-Function
re: Knowing the FTYPE of sqrt does not allow a compiler to substitute 2.23 for
(sqrt 5). You might redefine SQRT as SIN without violating the FTYPE.
Right. So your intention for "constant function" really was more along the
line of "constant foldable" (or "reducible"), just as I guessed in my first
message?
In fact, "constant function" by this definition doesn't even imply a
constant argument sepectrum. Imagine a function (defun foo (x y) ...)
which is "folded" as follows: (foo 2 3) --> 5; then at runtime the user
redefines it as (defun foo (x y &optional z) ...) in such a way that
(foo 2 3) = (foo 2 3 nil) = 5. No violation of compiler optimizations.
re: Some Symbolics users use ' in place of #' to get around this bug. (!)
I think it exists exactly because the 'constant-function' declaration
is missing, . . .
Well, Hornig did mention, and others concurred, that the much more common
case is to want this assumption; and having to place extra declarations
around all the common cases would be a pain.
-- JonL --