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

adding side effects to defmethod?

I want to be able to have a form like:

  (defmethod button-pressed ((window x-window) event)
    . . .)

have some side-effects, like calling XSelectInput in appropriate
places.  From reading the CLOS document (87-002) and poking around in
the pcl sources, I decided to try the following:
- Make a subclass of the clos::standard-generic-function class.
- Specialize the clos:add-method method for that subclass.
- Change the class of the clos::method-generic-function of the method
  returned by defmethod to be the subclass that I defined.

Unfortunately, the change-class failed:
  Error in function CHANGE-CLASS.
  Wrong type argument, #<Standard-Generic-Function BUTTON-PRESSED (1) >,
should have been of type SIMPLE-VECTOR.

Is there a better approach to this sort of thing?