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

DEFCONSTANT



I've had a further thought about what I said about DEFCONSTANT -- my
example 

  (eval-when (eval compile load)
    (defconstant max-index 100)
    (defconstant max-count (1+ max-index)))

assumes that the compiler will do the optimization which the specification
at most permits but does not encourage.  So in order for this to be
portable without loss of efficiency, the correct answer would be:

  (eval-when (eval compile load)
    (defconstant max-index 100))
  (defconstant max-count #.(1+ max-index))

Although if the second constant were to be used in another constant
definition, then it would need to be 

  (eval-when (eval compile load)
    (defconstant max-index 100))
  (eval-when (eval compile load)
    (defconstant max-count #.(1+ max-index)))

Note that separate EVAL-WHENs are needed in order for the #. to work
right.

Come on; do we really expect users to be able to understand this?

Sandra has suggested that instead of holding up voting on proposal
COMPILE-FILE-HANDLING-OF-TOP-LEVEL-FORMS:CLARIFY that I submit a separate
proposal to amend the definition of DEFCONSTANT; I will plan to do that.