home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / lisp / 2202 < prev    next >
Encoding:
Text File  |  1992-08-12  |  1.6 KB  |  49 lines

  1. Newsgroups: comp.lang.lisp
  2. Path: sparky!uunet!decwrl!parc!gregor
  3. From: gregor@parc.xerox.com (Gregor Kiczales)
  4. Subject: Re: having a tiny prob with CLOS
  5. In-Reply-To: chyde@pecos.ads.com's message of 10 Aug 92 20:03:55 GMT
  6. Message-ID: <GREGOR.92Aug12133951@tracer-bullet.parc.xerox.com>
  7. Sender: news@parc.xerox.com
  8. Organization: Xerox Palo Alto Research Center
  9. References: <cyen.713460550@ponder> <CHYDE.92Aug10150355@pecos.ads.com>
  10. Date: 12 Aug 92 13:39:51
  11. Lines: 36
  12.  
  13. In article <CHYDE.92Aug10150355@pecos.ads.com> chyde@pecos.ads.com (Clinton Hyde) writes:
  14.  
  15.    From: chyde@pecos.ads.com (Clinton Hyde)
  16.    Date: 10 Aug 92 20:03:55 GMT
  17.  
  18.    i have a method I want to remove. to do so, I need to find it with
  19.    find-method, but i haven't been able to figure out what FIND-METHOD
  20.    really wants as args.
  21.  
  22.    (find-method (ensure-generic-function my-method-name) NIL '(t))
  23.  
  24.    but this doesn't work.
  25.  
  26. The specializers have to be "specializers" not "specializer names."  The
  27. AMOP makes this distinction more clear than it is in CLtLII.  So, you can
  28. fix this case by saying:
  29.   
  30.   (find-method #'foo
  31.                ()
  32.                (mapcar #'find-class '(t)))
  33.  
  34.  
  35. Another way that is often much easier, especially in the common case
  36. where there are only a few methods on the generic function, is to grovel
  37. through the result of GENERIC-FUNCTION-METHODS.  Like this:
  38.  
  39. (defmethod f1 ((x foo)) ..)
  40. #<Method F1 (FOO) ..>
  41. (defmethod f1 ((x bar)) ..)
  42. #<Method F1 (BAR) ..>
  43.  
  44. (generic-function-methods #'f1) 
  45. (#<Method F1 (BAR) ..> #<Method F1 (FOO) ..>)
  46.  
  47. (remove-method #'f1 (cadr *))  ; this removes the method specialized to FOO
  48.  
  49.