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

Plan



The following are changes LGD and I intend to make to chapters 1 and
2 unless we hear to the contrary by tuesday:

1. symbol-class => find-class (function)
   cboundp, cmakunbound flushed

	   Find-class will take an optional second argument saying whether
	   or not is should signal an error if there is no class with that
	   name.  The default value of the argument will be t.  If that
	   argument is nil, and there is no class with the given name,
	   find-class will return nil.  We will say that the first
	   argument to find-class must be a symbol.  Others can extend
	   that later if they want.

	   cboundp and cmakunboundp will be removed.  cboundp can be
	   replaced with (find-class <name> nil).  cmakunbound can be
	   replaced with (setf (find-class <name>) nil).

2.  The following generic function name changes will be made:

   initialize-new-instance => initialize-instance
   initialize-instance => shared-initialize

3. :documenatation slot option will added.

	   Here is a recap of what this slot option does.

	   This option would provide a documentation string for the
	   automatically generated :reader or :writer methods for the
	   slot.

	   So:

           (defclass foo ()
             ((x :reader foo-x
                 :reader bar-x
	         :writer (setf foo-x)
	         :documentation "the x slot stores the x position")))

           would be equivalent to:

           (defclass foo ()
             ((x)))

	   (defmethod foo-x ((foo foo))
	     "the x slot stores the x position"
	     (slot-value foo 'x))

	   (defmethod bar-x ((foo foo))
	     "the x slot stores the x position"
	     (slot-value foo 'x))

	   (defmethod (setf foo-x) (new-value (foo foo))
	     "the x slot stores the x position"
	     (setf (slot-value foo 'x) new-value))

4. NO-NEXT-METHOD will be added.

5. GENERIC-FUNCTION will become a macro.

6. CHECK-KEYWORD-ARGUMENTS (function) will be added.

	   Note that part of what Danny is proposing here is to eliminate
	   the special-purpose function check-initargs, which was only for
	   initialization arguments, and replace it with a general purpose
	   function check-keyword-arguments that can be used in any
	   situation involving multiple generic functions accepting a
	   common set of keyword arguments.  Initialization arguments are
	   probably the only such situation among the predefined functions
	   of CLOS, but users might define similar protocols in their own
	   programs.

	   Sonya suggests that since this is a general purpose function,
	   it should be written up in chapter 2.  I agree.  The
	   implementation of this function involves calling chapter 3
	   functions, but callers of the function don't need to understand
	   the implementation.

	   check-keyword-arguments keyword-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)))
	       (check-keyword-arguments
                 initargs
                 (list (list #'allocate-instance class)
		       (list #'initialize-instance proto nil)
		       (list #'initialize-new-instance proto))
		 (class-slot-initargs class)))
	       .
	       .
	       .)

	   check-keyword-arguments should signal the error itself, and the
	   call in MAKE-INSTANCE should ignore the returned value.

	   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.

7. CHECK-INITARGS will be flushed.

			-rpg-