defclass* and friends for those who like them


defclass-star contains various defclass-like macros that preprocess slot definitions to achieve a more concise syntax. At the time of writing these macros are: defclass*, defcondition*, defcomponent* and deflayer*. An example that demonstrates some of the features:

(defclass* some-class (some super classes)
  ((slot1 42)
   (slot3 :type boolean)))


(defclass some-class (some super classes)
  ((slot1 :initform 42 :accessor slot1-of :initarg :slot1)
   (slot2 :accessor slot2-of :initarg :slot2)
   (slot3 :accessor slot3-p :initarg :slot3 :type boolean)))

And a feature-stuffed version:

(defclass* some-class (some super classes)
  ((slot1 42 :documentation "zork" :writer (setf custom-writer))
   (slot2 :unbound :accessor slot2-custom :initarg nil)
   (slot3 :type boolean))
  (:export-accessor-names-p t)          ; these are only some of the options, see the code for details
  (:export-class-name-p t)
  (:export-slot-names-p t))


  (defclass some-class (some super classes)
    ((slot1 :initform 42 :writer (setf custom-writer) :initarg :slot1 :documentation "zork")
     (slot2 :accessor slot2-custom)
     (slot3 :accessor slot3-p :initarg :slot3 :type boolean)))
  (export (list 'some-class 'custom-writer 'slot2-custom 'slot3-p 'slot1 'slot2 'slot3) #<package "DEFCLASS-STAR.TEST">)
  (find-class 'some-class nil))

See test.lisp for more examples and/or configuration.lisp from Verrazano for a real-life example.

Mailing Lists



You can browse the defclass-star repository or get the tree with

darcs get


BSD / Public Domain