[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
From: IN%"firstname.lastname@example.org.EDU" "Jon L White" 6-MAY-1988
Isn't it the case that *any* proclaim about a function is equivalent to
saying that that aspect of the function is "constant"?
Yes, I think this is true.
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
No. I think my proposal is more general than that. At any point when I am
writing a large program I know that 50-90% of the functions are "mature"
and very unlikely to be changed, except perhaps for optimizations. I want
a way to tell that to the compiler.
re: The declaration (CONSTANT-FUNCTION foo) . . . With SPACE=0, SPEED=3 this
should be equivalent to an INLINE declaration.
I don't think so, ...
This is based upon a strict reading of CLtL P.160 about Declare Optimize.
"The value 0 means that the quality is TOTALLY unimportant." I think a
common-sense clause might be added to this description. Clearly we don't
want compilers to use up exponentially large amounts of space when given
a (declare (optimize (space 0)))
I see 'inline' and 'constant-function' as independent dimensions.
I think there are some close connections. 'inline' implies 'constant-function'
and 'constant-function' allows (but doesn't require) 'inline' compilation.
Small 'constant-function's would likely be compiled 'inline'.
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
That is a reasonable interpretation of declare, but
I think there should be some way to closely associate global
declaration-type stuff with a function's definition. For example,
make-array, defstruct and (ZL) defflavor have syntactic places for
arbitrary declarations about the new entity. DEFUN does not
except, perhaps, using an embedded DECLARE. Of course, the world
will not come to an end because people have to use a separate
proclaim. I just think it would be nicer to put everything
about a function definition into a single form.
Another solution is to define a macro encapsulaing the DEFUN and
PROCLAIM. For example ZL defsubst could be implemented this way
quite trivially. I have a more radical (sounding) proposal that
builds on this. I don't have time to defend it, so I am hoping
that it will grow out of the discussion naturally. I also don't
have a good name for such a macro. 'Defconfun' is rather bletcherous.
'define' would do, but Sussman's students would start schemeing