[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: ELIOT@cs.umass.edu
- Subject: Constant Functions
- From: Jon L White <firstname.lastname@example.org>
- Date: Thu, 5 May 88 19:05:54 PDT
- Cc: email@example.com
- In-reply-to: ELIOT@cs.umass.edu's message of Wed, 4 May 88 10:35 EDT <8805051650.AA04252@edsel.lucid.com>
Isn't it the case that *any* proclaim about a function is equivalent to
saying that that aspect of the function is "constant"? What you are
looking for is a way to say that "constant folding" is ok; of course,
the function must be defined and usable in the compilation environment
for this to work. Generally speaking, "constant folding" is ok as long
as the function is side-effect free; so maybe that is the declaration
re: The declaration (CONSTANT-FUNCTION foo) . . . With SPACE=0, SPEED=3 this
should be equivalent to an INLINE declaration.
I don't think so, or at least not if what you primarily want is a way to
legitimze "constant folding". For example,
(defun run-around-and-double (x)
...lots of contorted code ...
... ultimately returning (* 2 x) ...
Then declaring this a constant-function should permit the compiler to convert
(run-around-and-double '6) into '12; but hopefully wouldn't cause in-lining
of (run-around-and-double x). I see 'inline' and 'constant-function' as
re: As a special case (declare constant-function) in a DEFUN is equivalent
to both a proclaim and the defun.
This is too special-casey. Any declare in a DEFUN (or any other place that
admits 'declare') should have only local, lexical scope; or at least, so I
-- JonL --