Search code examples
common-lispclos

How to browse class hierarchy with slime in common-lisp


I'm using emacs,+slime+sbcl.

I can go up a class hierarchy while I inspect a class/object through the slime-inspector. But how can I browse subclasses of a specific class ? Is there a slime function (or another way) to do that ?


Solution

  • Yes, it should appear in the DIRECT-SUBCLASSES slot in the inspector.

    In case you don't see it, it might be because your Slime inspector isn't fancy:

    (setq slime-contribs '(slime-fancy))
    

    Or just call M-x slime-enable-contrib followed by fancy, which enables all fancy features (technically fancy-inspector should be enough).

    You can also do it in your programs by using Closer MOP:

    (closer-mop:class-direct-subclasses (find-class 'number))
    => (#<BUILT-IN-CLASS COMMON-LISP:COMPLEX> #<BUILT-IN-CLASS COMMON-LISP:REAL>)