Untitled Document - subsection Evaluation at Compile time

Go to the first, previous, next, last section, table of contents.

# subsection Evaluation at Compile time

In GCL the eval-when behaviour was changed in order to allow more efficient init code, and also to bring it into line with the resolution passed by the X3j13 committee. Evaluation at compile time is controlled by placing eval-when special forms in the code, or by the value of the variable compiler::*eval-when-defaults* [default value :defaults]. If that variable has value :defaults, then the following hold:

Eval at Compile Type of Top Level Form

Partial:
  defstructs, defvar, defparameter
Full:
  defmacro, defconstant, defsetf, define-setf-method, deftype, package ops, proclaim
None:
  defun, others

By `partial' we mean (see the X3J13 Common Lisp document (doc/compile-file-handling-of-top-level-forms) for more detail), that functions will not be defined, values will not be set, but other miscellaneous compiler properties will be set: eg properties to inline expand defstruct accessors and testers, defstruct properties allowing subsequent defstructs to include this one, any type hierarch information, special variable information will be set up.

Example:

    (defun foo () 3)
    (defstruct jo a b)

As a side effect of compiling these two forms, foo would not have its function cell changed. Neither would jo-a, although it would gain a property which allows it to expand inline to a structure access. Thus if it had a previous definition (as commonly happens from previously loading the file), this previous definition would not be touched, and could well be inconsistent with the compiler properties. Unfortunately this is what the CL standard says to do, and I am just trying to follow it.

If you prefer a more intuitive scheme, of evaling all forms in the file, so that there are no inconsistencies, (previous behaviour of AKCL) you may set compiler::*eval-when-defaults* to '(compile eval load).

The variable compiler::*FASD-DATA* [default t] controls whether an ascii output is used for the data section of the object file. The data section will be in ascii if *fasd-data* is nil or if the system-p keyword is supplied to compile-file and *fasd-data* is not eq to :system-p.

The old GCL variable *compile-time-too* has disappeared.

See OPTIMIZE on how to enable warnings of slow constructs.

Function: PROCLAIM (decl-spec)
  Package:LISP

  Puts the declaration given by DECL-SPEC into effect globally. See the doc of DECLARE for possible DECL-SPECs.

Function: PROVIDE (module-name)
  Package:LISP

  Adds the specified module to the list of modules maintained in *MODULES*.

Function: COMPILED-FUNCTION-P (x)
  Package:LISP

  Returns T if X is a compiled function; NIL otherwise.

Variable: *FEATURES*
  Package:LISP List of symbols that name features of the current version of GCL. These features are used to decide the read-time conditionalization facility provided by '#+' and '#-' read macros. When the GCL reader encounters

      	#+ feature-description form

  it reads FORM in the usual manner if FEATURE-DESCRIPTION is true. Otherwise, the reader just skips FORM.

      	#- feature-description form

  is equivalent to

      	#- (not feature-description) form

  A feature-description may be a symbol, which is true only when it is an element of *FEATURES*. Or else, it must be one of the following:

      (and feature-desciption-1 ... feature-desciption-n)
      (or  feature-desciption-1 ... feature-desciption-n)
      (not feature-desciption)

  The AND description is true only when all of its sub-descriptions are true. The OR description is true only when at least one of its sub-descriptions is true. The NOT description is true only when its sub-description is false.

Go to the first, previous, next, last section, table of contents.