[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to add slots to method objects

I am trying to add slots to method objects and to generic-function objects
using Victoria Day PCL on Lucid 3.0.2.

If I understand the 88-00R document correctly (in particular, the
DEFGENERIC description and its :method-class option), this could be done

1. creating a new class of methods:

(defclass action-method

   ( (type	 :reader action-type ) )

2. telling PCL that certain methods are instances of action-method:

(defgeneric move (object position)
   (:method-class 'action-method)

3. And I could retrieve the slot values using:

(defun find-action-type (action qualifiers &rest object-types)
   (let ((method-used (find-method action qualifiers object-types)))
       (action-type method-used)

The first one was easy.  Unfortunately, DEFGENERIC doesn't yet accept
options and FIND-METHOD is not implemented yet.

I tried ENSURE-GENERIC-FUNCTION, but it ignores the relevant options.  I
tried CHANGE-CLASS on a method, but there is no method defined for
CHANGE-CLASS on action-method classes.  I also looked in the section on
Meta-Objects (p. 1-33, 1-34), but chapter 3 is not available yet for

It there a solution to this?  I am considering modifications to the PCL
source to add those slots as part of the STANDARD-METHOD definition but
that is an ugly hack.



Martin Boyer                           
McGill Research Centre for Intelligent Machines
McGill University, Montreal, QC