[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
method specalization on defstructs
- To: CommonLoops.PA@Xerox.COM
- Subject: method specalization on defstructs
- From: John W. Dye Jr. <firstname.lastname@example.org>
- Date: Thu, 20 Oct 88 15:13:53 PDT
- Redistributed: CommonLoops.PA
We have some need to be able to specalize methods on defstructs.
We have been doing this by using pcl:define-built-in-classes
on the names of our defstructs. When swithching from St-paddys-day
to AAAI pcl we have encountered problems with doing the following:
This is loaded in a file (package view).
(setq *view-built-in-classes* '((dynamic-struct (t))
(setq pcl::*built-in-classes* (append pcl::*built-in-classes*
VIEW> (setq s (make-dynamic-struct))
#S(DYNAMIC-STRUCT DYNAMIC-SLOT NIL)
VIEW> (defmethod blues ((object number))
(print "blues number"))
VIEW> (defmethod blues ((object dynamic-struct))
(print "blues dynamic-struct"))
VIEW> (blues 13)
VIEW> (blues s)
>>Error: No matching method for the generic-function #<Compiled-Function
when called with arguments (#S(DYNAMIC-STRUCT DYNAMIC-SLOT NIL)).
Required arg 0 (GENERIC-FUNCTION): #<Compiled-Function BLUES 9B17AE>
:A 0: Abort to Lisp Top Level
Abort to Lisp Top Level
Back to Lisp Top Level
VIEW> (pcl::describe-class (find-class 'dynamic-struct))
The class #<Built-In-Class DYNAMIC-STRUCT 51304616> is an instance of class
#<Standard-Class PCL::BUILT-IN-CLASS 35772146>.
Class-Precedence-List: (DYNAMIC-STRUCT T)
#<Built-In-Class DYNAMIC-STRUCT 51304616>
Should this work?? Am I the victim of package problems??
Am I doing something inherently evil??
Should I be locked in a closet with the pcl source until
I understand how method lookup works??