[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using nonstandard method-class in generic-functions
- To: CommonLoops.PA@Xerox.COM
- Subject: Using nonstandard method-class in generic-functions
- From: Martin Boyer <gamin@Moe.McRCIM.McGill.EDU>
- Date: Mon, 3 Jul 89 14:50:53 EDT
- Cc: gamin@Moe.McRCIM.McGill.EDU
- Redistributed: CommonLoops.PA
I am trying to define my own class of methods
using Victoria Day PCL on Lucid 3.0.2.
I am having a problem using DEFMETHOD on generic functions when the method
class (defined through GENERIC-FUNCTION-METHOD-CLASS) is not STANDARD-METHOD.
It may be a PCL bug somewhere, but I'm not really good enough to tell.
From the following transcript, perhaps some kind soul can tell me what is
going wrong:
;;; Given the following definitions:
(defclass widget
()
( (position :accessor widget-position
:initform nil) )
)
;;;; ACTION-METHOD
;;; This is simply a standard method with additional slots.
;;;
(defclass action-method
(standard-method)
( (type :reader action-type) )
)
;;; The following is an edited transcript:
> (setq gf (ensure-generic-function 'hello :lambda-list '(object)))
#<Compiled-Function HELLO 75491F>
> (setf (pcl::generic-function-method-class gf) (find-class 'action-method))
#<Standard-Class ACTION-METHOD 34362573>
> (describe gf)
#<Compiled-Function HELLO 75491F> is an instance of class
#<Funcallable-Standard-Class PCL::STANDARD-GENERIC-FUNCTION 73606503>:
The following slots have :INSTANCE allocation:
NAME HELLO
METHODS NIL
DISCRIMINATOR-CODE NIL
CLASSICAL-METHOD-TABLE NIL
COMBINED-METHODS NIL
CACHE NIL
VALID-P NIL
PRETTY-ARGLIST NIL
METHOD-CLASS #<Standard-Class ACTION-METHOD 34362573>
DISPATCH-ORDER :DEFAULT
> (defmethod hello
( (self widget) )
(format t "~A (a widget) says hello.~%" self)
)
>>Error: The value of ARRAY, NIL, should be of type (ARRAY * (*))
LUCID-RUNTIME-SUPPORT:1DIM-AREF-SUBR:
Required arg 0 (ARRAY): NIL
Required arg 1 (I): 3
:C 0: Use a new value
:A 1: Abort to Lisp Top Level
-> :a
Abort to Lisp Top Level
Back to Lisp Top Level
> (quit)
Note that if I use
(setf (pcl::generic-function-method-class gf) (find-class 'standard-method))
instead, I don't get the error.
By the way, many thanks to kanderso@DINO.BBN.COM for the
ENSURE-GENERIC-FUNCTION and GET-METHOD tricks that allowed me to get
this far.
Thanks,
Martin
--
Martin Boyer
McGill Research Centre for Intelligent Machines
McGill University, Montreal, QC
gamin@larry.mcrcim.mcgill.edu
gamin@mcgill-vision.uucp