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

lambda-list congruence



Here is the lambda-list congruence writeup, revised to use CLtL's terminology
for keyword arguments instead of introducing new terminology:

LAMBDA-LIST CONGRUENCE

Changes to Lambda-list Congruence Rules (p.1-20): Rules 1, 2, and 6 remain the
same, except for wording problems, while rules 3-5 need to be replaced to
implement the new rules for &KEY and to fix the interaction among &KEY, &REST,
and &ALLOW-OTHER-KEYS.  The new rules for congruence are the following:

  These rules define the congruence of a set of lambda-lists, including the
  lambda-list of each method for a given generic function and the lambda-list
  specified with DEFGENERIC, if present.  For (SETF generic) methods, these
  rules apply to the effective lambda-list produced by combining the two
  specified lambda-lists according to the rules on page nnn.

  1. Each lambda-list must have the same number of required parameters.

  2. Each lambda-list must have the same number of optional parameters.
  Each method can supply a different default for an optional parameter.

  3. If any lambda-list uses &REST or &KEY, each lambda-list must use one or
  more of these.

  4. If the DEFGENERIC uses &KEY, each method must accept all of the
  keyword names mentioned after &KEY in DEFGENERIC, either by accepting
  them explicitly, by specifying &ALLOW-OTHER-KEYS, or by specifying &REST
  but not &KEY.  Each method can accept additional keyword arguments of its
  own.  The checking of the validity of keyword names is not done in each
  method; instead it is done in the generic function.

  5. The use of &ALLOW-OTHER-KEYS need not be consistent across lambda-lists.
  If &ALLOW-OTHER-KEYS is used in any lambda-list, then any keyword arguments
  may be used in the call to the generic function.

  6. The use of &AUX need not be consistent across methods.