VariablePackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

*redefinition-warnings*

This variable controls most redefinition warnings. There are four kinds of such warnings:

  1. Defining something in two different files (or in a file and at the listener).
  2. Defining something twice in a single file.
  3. Defining a macro as a function.
  4. Defining a function as a macro.

This variable controls the first three types. It does not affect the fourth type (a warning in that case is signaled unconditionally). See below for more information on this case.

If the value of this variable is nil, redefinitions of the first three listed types will not signal warnings under any circumstances.

If the value of this variable is true, redefinition of the third listed type will signal a warning that a macro is being redefined as a function.

If true, the value should be either t or a list of keywords identifying the objects for which redefinition warnings should be printed. If it is t, warnings are signaled for the first three types of redefinition. If it is a list of keywords, warnings are signaled for type 1 and 2 redefinitions only if the relevant keyword is present. The following table shows many of the the keywords supported.

Redefinition keywords and their effect

Keyword

Definitions for which warnings will be printed

:operator

defun

clos:generic-function

defmacro

:variable

defconstant

defparameter

defvar

:special-declaration

defconstant

defparameter

defvar

:compiler-macro define-compiler-macro
:setf-method defsetf
:type

defclass

defstruct

deftype

The initial value of this variable is a list containing all six keywords. Note that the initial value when using the Integrated Development Environment also contains certain symbols and keywords specific to the IDE (and not further documented).

The function load and its associates like the top-level command :ld lambda binds this variable to itself when loading a file so the value of this variable cannot be changed by a form in a file being loaded. The following form in a file will change the value outside the binding:

(setf (mp:global-symbol-value 'excl:*redefinition-warnings 
                              <new-value>)

More on redefining a function as a macro. If a function is redefined as a macro, calls to the operator in code compiled before the redefinition will signal an error. That is because the call is to the function previously defined, and the system is unable to convert the call into an appropriate macro expansion. (See Attempt to call -name- which is defined as a macro in errors.htm.) Because the change can result in an error, it is considered best that the warning not be controlled by a global variable. If you want to suppress the warning, wrap the defmacro call in a handler-bind like this:

(handler-bind 
  ((warning #'(lambda (c) (declare (ignore c)) (muffle-warning))))
  (defmacro foo ....))

See Redefinition warnings in source-file-recording.htm. See also without-redefinition-warnings.


Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version