Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.22 KB

0174-list-named-class.org

File metadata and controls

41 lines (29 loc) · 1.22 KB

list-named-class

This is the library by Michał “phoe” Herda. It extends CLOS allowing to use lists of symbols as class names:

POFTHEDAY> (list-named-class:defclass (:user :model) ()
             ())

POFTHEDAY> (list-named-class:defclass (:user :view) ()
             ())

POFTHEDAY> (list-named-class:defgeneric render (obj))

POFTHEDAY> (list-named-class:defmethod render ((obj (:user :view)))
             (format nil "Rendered User View"))

POFTHEDAY> (list-named-class:make-instance '(:user :view))
#<(:USER :VIEW) {10076F6CC3}>

POFTHEDAY> (render *)
"Rendered User View"

This can be useful when classes are defined using some macros. Not sure why somebody should prefer such class-names instead of symbols.

Here are some examples of list-named-class usage I found in the wild: