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

Re: defgeneric :method option



    Date: Mon, 8 Feb 88  08:48:54 CST
    From: Patrick H Dussud <DUSSUD@jenner.csc.ti.com>

    A small detail.  Since we remove the methods that were defined by
    :method in a DEFGENERIC, it would be consistent to allow the change of
    the lambda-list if the only methods defined for this generic function
    are the one defined by :method. Logically, we are in the case
    where there is no method on the updated generic function.

That's a good point.  I agree.

What's in the current version (just looked at a few minutes ago) of
chapters 1 and 2 doesn't really need to be changed for this, since it
doesn't say in specific detail what the macroexpansion of defgeneric
is; I guess that's chapter 3 material.  It probably is a good idea to
update the remark part of defgeneric.

    If we agree on this, it means that the remark part of defgeneric must
    be updated, and the following form cannot be the expansion of
    DEFGENERIC:

	 (progn
	   (ensure-generic-function 'name :blah blah blah)
	   (let ((methods (list (defmethod name blah blah blah)
			   (defmethod name blah blah blah)
			   ...))
	    (generic (symbol-function 'name)))
	     (dolist (method (generic-function-locally-defined-methods generic))
	       (remove-method generic method))
	     (setf (generic-function-locally-defined-methods generic) methods)
	     generic))

I agree that your suggestion is right, even though at this moment I don't
know what I think the precise macroexpansion to implement it ought to be.