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

Compile time constants



This probably ought to be documented in the manual.
---------------------------

Date: 12 MAR 1981 2000-PST
From: MASINTER.PA
Subject: new CONSTANTS
To:   Yonke at BBND, Lewis at BBND
cc:   LispCore^

I think I have a new implementation of CONSTANTS which is reasonable.

The function CONSTANTS is on MISC (unfortunately, MACHINEINDEPENDENT,
which contains the CONSTANTS macro, is too late for bootstrapping
purposes). 

(CONSTANTS VAR1 VAR2 (VAR3 FORM3) VAR4)

define VAR1, ... VAR4 to be "constants": the compiler, when it
encounters a (free) reference to a constant will compile instead
  (CONSTANT VAR1)
  (CONSTANT VAR2)
  (CONSTANT FORM3)

That is, variables which appeared as an atom in a call to CONSTANTS
will merely get wrapped in a "CONSTANT" call.

Variables which appear in the CONSTANTS call as (atm form) will
get compiled as if the user had said (CONSTANT form) instead of atm.

The CONSTANTS file package command
	(CONSTANTS var1 var2 (var3 form) var4)

is equivalent to

  (DECLARE: EVAL@COMPILE
	(VARS var1 var2 (var3 form) var4)
	(P (CONSTANTS var1 var2 (var3 form) var4)))


Note that CONSTANTS are no longer DONTCOPY as the default.

Larry
------
------------------------------------------------------------