[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: common-lisp@SAIL.STANFORD.EDU
- Subject: Constant-Function
- From: ELIOT@cs.umass.edu
- Date: Wed, 11 May 88 14:55 EDT
From: Gail Zacharias <firstname.lastname@example.org.COM>
I believe the point of a CONSTANT-FUNCTION declaration would be to allow
references to the function cell of a symbol to be replaced with its
compile-time contents (or moral equivalent thereof). I.e. to tell the
compiler that it can replace (FOO ...) with (FUNCALL '#<Function FOO> ...).
Constant-Function allows much more general and useful optimizations than this.
Regarding inlining, I think it is perfectly valid for a compiler to inline
explicit constant references to compiled functions (i.e. references of the
form '#<Function>) since there is nothing in common lisp that would
allow you to tell the difference.
TRACE is a Common Lisp function that allows you to see the difference.
Having said all that, I don't think a CONSTANT-FUNCTION declaration would be
very useful. Unlike variables, most functions in most programs are constant
(once debugging is done), and you don't really want to maintain huge sets of
CONSTANT-FUNCTION declarations all over the place (that you have to keep
turning off when you need to debug).
How does the compiler know that debugging is done, without a constant-function
declaration? Should a compiler just *assume* that every function is
debugged? What good are debugging tools then?
.... I don't really see any need here for language extensions, since
requesting block compilation is sort of an environmental issue that I don't
think needs to be standardized; and for the exceptions, NOTINLINE will do fine
since any implementation that 'snaps links' on functions declared NOTINLINE
is asking to lose anyway given current usage.
I don't believe there is such a clear separation between language and
environment issues. Furthermore I don't believe that "environment
issues" should be rigidly excluded from a language. We don't want
to impose requirements on the environment that would make Lisp less
portable. Certainly block compilation could be addressed as an
environment issue. But your proposal actually makes it clear that
this cannot be completely handled as an environment issue. You
want to split things up so that requests for block compilation are
made through the environment, but exceptions to this are handled
within the language? Wouldn't it be better to do things one
way or the other, rather than both at once?