CLOS Class

Documentation for CLOS Classes is configured like

.. cl:clos-class:: symbol-name

The :cl:clos-class: directive emits Common Lisp Object System (CLOS) class documentation:

.. cl:clos-class:: example-class

The :noinitargs: option can be specified to exclude the class’ list of :initarg initialzers that are ordinarily included in the class’ signature:

.. cl:clos-class:: example-class
   :noinitargs:

Note: There is no mechanism or directive to document individual slots at the moment.

Code

(defclass example-class ()
  ((slot1 :initarg :slot1 :accessor slot1
          :initform "default"
          :documentation "the first slot.")
   (slot2 :initarg :slot2 :accessor slot2
          :documentation "the second slot."))
  (:documentation "An example class."))

Output

CLOS class example-class
Superclass:

[‘T’]

Metaclass:

standard-class

Initargs:

An example class.

CLOS slot sphinxcontrib.cldomain.doc::slot2
Type:

sb-mop:standard-direct-slot-definition

Initarg:

:slot2

Reader:

(sphinxcontrib.cldomain.doc::slot2 (object example-class))

Writer:

(setf (sphinxcontrib.cldomain.doc::slot2 (object example-class)) (new-value T))

the second slot.

CLOS slot sphinxcontrib.cldomain.doc::slot1
Type:

sb-mop:standard-direct-slot-definition

Initarg:

:slot1

Reader:

(sphinxcontrib.cldomain.doc::slot1-alt (object example-class))

Reader:

(sphinxcontrib.cldomain.doc::slot1 (object example-class))

Writer:

(setf (sphinxcontrib.cldomain.doc::slot1-alt (object example-class)) (new-value T))

Writer:

(setf (sphinxcontrib.cldomain.doc::slot1 (object example-class)) (new-value T))

the first slot.

Code

(define-condition example-error (simple-error)
    ((message
      :initarg :message
      :accessor error-message
      :initform nil
      :documentation "Message indicating what went wrong."))
  (:documentation "An example condition"))

Output

CLOS class example-error
Superclass:

[‘T’]

Metaclass:

sb-pcl::condition-class

Initargs:

An example condition

CLOS slot sphinxcontrib.cldomain.doc::message
Type:

sb-pcl::condition-direct-slot-definition

Initarg:

:message

Reader:

(sphinxcontrib.cldomain.doc::error-message (object example-error))

Writer:

(setf (sphinxcontrib.cldomain.doc::error-message (object example-error)) (new-value T))

Message indicating what went wrong.