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

Compile-time enforcement of Common Lisp type declarations



To add fuel to the discussion, here's an example from another Common
Lisp compiler.  The latest Explorer compiler does a fair amount of
consistency checking of type declarations (not really "enforcement",
because the warnings are nonfatal).  For instance

  (defun foo ()
    (let ((bar nil))
       (declare (type fixnum bar))
       ...))

will give a warning that the initial value is inconsistent with the
declared type.

However, type checking is not done for DEFSTRUCT slots, at either
compile or run time.  (I tried it.)

-- Scott