[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DEFCONSTANT



    Date:  8 June 1983 0146-EDT (Wednesday)
    From: Guy.Steele@CMU-CS-A
    The initial-value form to DEFCONSTANT is conceptually evaluated at load
    time.  DEFCONSTANT is an invitation to the compiler to susbtitute the
    value for occurrences of the constant *if* the compiler is smart enough
    to do so.  DEFCONSTANT is not meant to side-effect the compiler's environment.
	    (DEFCONSTANT FOO 3)
	    (DEFCONSTANT BAR (+ FOO 6))
    entitles the compiler to use the value 9 for BAR provided that it is
    smart enough to analyze what it going on (actually notall that hard:
    the first declaration entitles the compiler to substitute 3 for FOO,
    whereupon some simple constant folding reduces (+ 3 6) to 9).
    --Guy
Ingenious!  This seems to be the best of all possible worlds (I admit
candidly).  Although I think, as per previous letters, the issue needs
some definitional and documentation-wise sorting out, this does seem
to solve all problems.  The answer to "What kind of evaluator or meta-
evaluator should be invoked on the second operand of DEFCONSTANT?" is
"the compiler's pass-1 optimizer/reducer"!  That is not something we
do now, but there is no good reason why not.