Article View: comp.lang.clos
Article #32[wwinston@Athena.MIT.EDU: having a tiny prob with CLOS - comp.lang.lisp #7889]
From: Whitney Winston
Date: Tue, 11 Aug 1992 19:41
Date: Tue, 11 Aug 1992 19:41
66 lines
2365 bytes
2365 bytes
In article <CHYDE.92Aug10150355@pecos.ads.com>, chyde@pecos.ads.com (Clinton Hyde) writes:
|>
|> i have a method I want to remove. to do so, I need to find it with
|> find-method, but i haven't been able to figure out what FIND-METHOD
|> really wants as args.
|>
|> here's CLtL2:
|>
|> (find-method generic-fn qualifiers specializers)
|>
|> here's an example:
|>
|> (find-method (ensure-generic-function my-method-name) NIL '(t))
The problem is that find-method is looking for a list of classes for
specializers....
(find-method (fdefinition 'my-method-name) nil `(,(find-class 't)))
should handle it.... fdefinition from CLtL2...
however Lucid 4.0.2 uses clos-sys:function-from-name
> (defmethod my-method-name (arg) 'foo)
#<Standard-Method MY-METHOD-NAME (T)>
> (defmethod my-method-name ((arg symbol)) 'bar)
#<Standard-Method MY-METHOD-NAME (SYMBOL)>
These are two random methods.
> (my-method-name 'hi)
BAR
Now, the method specializing on t and on symbol can each be
found as following:
> (find-method (clos-sys:function-from-name 'my-method-name)
nil
`(,(find-class 't)))
#<Standard-Method MY-METHOD-NAME (T)>
> (find-method (clos-sys:function-from-name 'my-method-name) nil `(,(find-class 'symbol)))
#<Standard-Method MY-METHOD-NAME (SYMBOL)>
The method specializing on symbol can be removed as follows:
> (remove-method (clos-sys:function-from-name 'my-method-name)
(find-method (clos-sys:function-from-name 'my-method-name)
nil
`(,(find-class 'symbol))))
#<Standard-Generic-Function MY-METHOD-NAME (1)>
This removes the method specializing on symbol as shown below.
> (my-method-name 'hi)
FOO
Whitney Winston
<wwinston@speckle.ncsl.nist.gov>
<wwinston@athena.mit.edu>
Technical Details
Message-ID:
<9208111941.AA14897@speckle.ncsl.nist.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!speckle.ncsl.nist.gov!wwinstonShow Full Headers
Complete Article Headers
Newsgroups: comp.lang.clos Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!speckle.ncsl.nist.gov!wwinston From: wwinston@speckle.ncsl.nist.gov (Whitney Winston) Subject: [wwinston@Athena.MIT.EDU: having a tiny prob with CLOS - comp.lang.lisp #7889] Message-ID: <9208111941.AA14897@speckle.ncsl.nist.gov> Sender: daemon@cis.ohio-state.edu Organization: The Ohio State University Department of Computer and Information Science Date: Tue, 11 Aug 1992 19:41:46 GMT Lines: 67