home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!darwin.sura.net!mips!apple!cambridge.apple.com!Laura_Bagnall@TERC.edu
- From: Laura_Bagnall@TERC.edu (Laura Bagnall)
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: >Getting rid of methods
- Message-ID: <00149.2794654153.26063@TERC.edu>
- Date: 22 Jul 92 16:55:25 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Organization: TERC, 2067 Mass. Ave., Cambridge, MA, 02140
- Lines: 23
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
- Original-To: derek@cambridge.apple.com (derek)
- Original-Cc: info-mcl@cambridge.apple.com (info-mcl)
-
-
- Reply to: RE>>Getting rid of methods
- >> Derek White asks:
- >> Has someone written a function that "undoes" the effect of a definition?
-
- This method when given either a generic function, or a symbol which is the
- name of a generic function, puts up a dialog with a list of all methods of
- that generic function, and removes the method you choose from the list.
-
- (defun undefine-method (generic-function)
- (setf generic-function (if (symbolp generic-function)
- (fdefinition generic-function)
- generic-function))
- (if (not (typep generic-function 'generic-function))
- (format t "~%~A is not a generic function." generic-function)
- (let ((method-to-be-removed
- (car (select-item-from-list
- (generic-function-methods generic-function)
- :window-title "Select a method to be removed"))))
- (when (y-or-n-dialog
- (format nil "OK to remove ~A?" method-to-be-removed))
- (remove-method generic-function method-to-be-removed)
- (format t "~%~A removed." method-to-be-removed)))))
-