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

Re: Reinitialization: check-initargs



    I just got another idea, which is to pass in a list of generic
    functions and arguments to which to apply them.

This can be made to work.

    But that doesn't work because we have forgotten that we are doing
    check-initargs, not check-keyword-arguments, and it has to worry
    about slot-filling initargs too.

One doesn't have to worry about the slot-filling initargs since those can be
passed in as extra-allowed-keywords.

check-keyword-arguments key-word-arguments
                        generic-functions-and-arguments
                        &optional extra-allowed-keywords

keyword-arguments is a p-list of keyword arguments to be passed to the
generic-functions in generic-functions-and-arguments.

generic-functions-and-arguments is a list of lists, each containing a generic
function followed by a list of the required arguments that can select
appropriate methods. 

extra-allowed-keywords is a list of additional allowed keywords.

make instance would call check-keyword-arguments this way

(defmethod make-instance ((class standard-class) &rest initargs)
  (setq initargs (default-initargs class initargs))
  (let((proto (class-prototype class)))
    (unless (check-keyword-arguments
               initargs
               (list (list #'allocate-instance class)
                     (list #'initialize-instance proto nil)
                     (list #'initialize-new-instance proto))
            (class-slot-initargs class))
     (error "illegal initarg")))
  .
  .
  .)


As for the check-keyword-arguments on page 60 of Chapter 3, it is the one that
is misnamed.  It should be called something more like
check-method-keyword-arguments.