RE: Defadvice and methods
That's absolutely correct, as I finally discovered just minutes ago. Sigh;
sometimes I can be awfully obtuse.
Thanks for the help.
dey
-----Original Message-----
From: Martin Simmons [mailto:martin@lispworks.com]
Sent: Thursday, August 11, 2005 2:35 PM
To: deyoung@bloodhoundinc.com
Cc: lisp-hug@lispworks.com
Subject: Re: Defadvice and methods
>>>>> On Wed, 10 Aug 2005 15:55:39 -0400, "Young, David"
<deyoung@bloodhoundinc.com> said:
David> Hi. I'm trying to attach a piece of :after advice to
initialize-instance. I
David> need to use advice because there's already an after method for this
David> initialize instance specialization in another package, and it's for
David> debugging purposes.
David> What is the proper way to write this? In particular, how do I
indicate &rest
David> in the specialization portion? According to Lispworks, the lambda
list for
David> initialize-instance is (INSTANCE &REST INITARGS &KEY
&ALLOW-OTHER-KEYS)
David> (lw:defadvice ((method initialize-instance (class-name <what goes
here?>))
David> assign-wmo-id :after)
David> (self)
David> (setf (gethash (get-next-wmo-id) *wm-instances*) self))
David> I've tried various incantations of the method dspec above, adding
&rest and
David> other things, but Lispworks always tell me:
David> Undefined function (METHOD INITIALIZE-INSTANCE (STANDARD-KB-OBJECT
T T)) in
David> form (LISPWORKS:DEFADVICE (METHOD INITIALIZE-INSTANCE
(STANDARD-KB-OBJECT T
David> T)))
The name of a method only includes the fixed (specialized) arguments, so the
&rest specialization just disappears. More importantly, the name needs to
include any qualifiers, so I think you probably want this:
(method initialize-instance :after (standard-kb-object))
--
Martin Simmons Email: martin@lispworks.com
LispWorks Ltd, St John's Innovation Centre TEL: +44 1223 421860
Cowley Road, Cambridge CB4 0WS, England. FAX: +44 870 2206189
This email message is for the sole use of the intended recipients(s) and may contain confidential and privileged information of Bloodhound Software, Inc.. Any unauthorized review, use, disclosure is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.