Hi,
Is there any access to MOP-like functionality in swank? I've not found it so I create a simple interface, similar to the xref one.
swank.lisp: ;;; MOP (defslimefun mop (type symbol-name) (let ((symbol (parse-symbol-or-lose symbol-name *buffer-package*))) (ecase type (:subclasses (class-direct-subclasses symbol)) (:superclasses (class-direct-superclasses symbol)))))
Maybe 'mop' isn't the best name.
swank-backend.lisp: ;;; MOP (definterface class-direct-subclasses (class-name) "Return the list of subclasses of class.")
(definterface class-direct-superclasses (class-name) "Return the list of superclasses of class.")
swank-cmucl.lisp: ;;; CLOS MOP (defimplementation class-direct-subclasses (class-name) (handler-bind ((simple-error (lambda (c) (declare (ignore c)) (return-from class-direct-subclasses nil)))) (let* ((class (find-class class-name)) (subclasses (pcl:class-direct-subclasses class))) (mapcar #'(lambda (x) (symbol-name (pcl:class-name x))) subclasses))))
(defimplementation class-direct-superclasses (class-name) (handler-bind ((simple-error (lambda (c) (declare (ignore c)) (return-from class-direct-superclasses nil)))) (let* ((class (find-class class-name)) (superclasses (pcl:class-direct-superclasses class))) (mapcar #'(lambda (x) (symbol-name (pcl:class-name x))) superclasses))))
The handler is to catch the errors of find-class with a class that doesn't exist. Maybe there's a better behaviour in that situation.
I have a generic browser in emacs that can be used to see the stuff above, xrefs,etc. I'll release the code soon.
Rui PatrocĂnio