anchor.diff:  ;;(defgeneric subscribe (instance))
   
   ;;(defgeneric unsubscribe (instance))
  +
  +
  +;; -------------- extrinsic methods --------
  +
  +(defstruct cim-parameter 
  +  name type qualifiers)
  +
  +
  +(defclass cim-method ()
  +  ((cim-name :initarg :cim-name :accessor cim-name)
  +   (return-type :initarg :return-type :accessor cim-method-return-type)
  +   (parameters :initarg :parameters :accessor cim-method-parameters)
  +   (qualifiers :initarg :qualifiers :accessor cim-qualifiers))
  +  (:metaclass closer-mop:funcallable-standard-class))
  +
  +(defmethod initialize-instance :after ((instance cim-method) &rest initargs &key &allow-other-keys)
  +  (do ((kwlist initargs (cddr kwlist)))
  +      ((null kwlist))
  +    (case (car kwlist)
  +      (:cim-name (setf (cim-name instance) (cadr kwlist)))
  +      (:return-type (setf (cim-method-return-type instance) (cadr kwlist)))
  +      (:parameters 
  +       (setf (cim-method-parameters instance)
  +             (mapcar (lambda (parameter)
  +                       (destructuring-bind (lisp-name &key name type qualifiers) parameter
  +                         (cons lisp-name
  +                               (make-cim-parameter :name name
  +                                                   :type type
  +                                                   :qualifiers qualifiers))))
  +                     (cadr kwlist))))
  +      (:function 
  +       (closer-mop:set-funcallable-instance-function instance (cadr kwlist))))))
  +
  +(def-cim-method mymethod ((instance myclass) (x uint32 "x" :in))
  +  ((:return-type uint32)
  +   (:cim-name "MyMethod"))
  +  "My little class"
  +  (declare (cim-class instance)
  +           (uint32 x))
  +  (values (1+ x)
  +          nil))
  +
  +(defmacro def-cim-method (name ((instance-var class-name) &rest parameters) options &body body)
  +  `(let ((method 
  +          (make-instance 'cim-method
  +                         :parameters
  +                         (list ,@(mapcar (lambda (parameter)
  +                                           (destructuring-bind (lisp-name type cim-name &rest qualifiers) parameter
  +                                             `(cons ',lisp-name
  +                                                    (make-cim-parameter 
  +                                                     :name ,cim-name
  +                                                     :type ',type
  +                                                     :qualifiers (make-qualifiers-list (list ,@qualifiers))))))
  +                                         parameters))
  +                         :return-type ',(cadr (assoc :return-type options))
  +                         :cim-name ,(cadr (assoc :cim-name options)))))
  +     ;; define a Lisp function
  +     (defun ,name (,instance-var ,@(mapcar #'car parameters)) ,@body)
  +     ;; set the funcallable instance function
  +     (closer-mop:set-funcallable-instance-function method (symbol-function ',name))
  +     
  +     ;; attach to the class
  +     (let ((class (find-class ',class-name)))
  +       (push method (cim-class-methods class)))
  +     ',name))
   
   ;; ------------ errors -----------
   
  
positive.code: 
  (defclass cim-class (closer-mop:standard-class)
    ((cim-name :initarg :cim-name :accessor cim-name)
     (qualifiers :initarg :qualifiers :initform nil :accessor cim-qualifiers))
    (:documentation "Metaclass used to represent CIM classes."))
  
  (defclass cim-association (cim-class)
  
negative.code: 	(dolist (ch (closer-mop:class-direct-subclasses class))
  	  (add-class-to-namespace ch ns :children t)))
    class)
    
  
  ;; --------------- cim types -----------
  