Functions from submarine: class-name-of, slot-names-of, slots-of.
Thu Aug 23 02:05:02 PDT 2007 Ryszard Szopa <ryszard.szopa@gmail.com>
* Functions from submarine: class-name-of, slot-names-of, slots-of.
diff -rN -u old-mop-utils/mop-utils.lisp new-mop-utils/mop-utils.lisp
--- old-mop-utils/mop-utils.lisp 2014-07-12 10:17:41.000000000 -0700
+++ new-mop-utils/mop-utils.lisp 2014-07-12 10:17:41.000000000 -0700
@@ -5,7 +5,7 @@
(:use :cl :closer-mop)
(:documentation "A set of Metaobject Protocol utilities.")
(:use #+sbcl :sb-mop #-sbcl :closer-mop)
- (:export #:defmetaclass))
+ (:export #:defmetaclass #:class-name-of #:slots-of #:slot-names-of))
(in-package :mop-utils)
@@ -64,3 +64,16 @@
,@(remove-if (lambda (sexp) (or (equal :validate-superclasses (car sexp))
(equal :slot-fixtures (car sexp)))) body)))))
+
+(defun class-name-of (object)
+ "The class-name of the class of OBJECT."
+ (class-name (class-of object)))
+
+
+(defun slot-names-of (object)
+ "List of names of the slots of OBJECT."
+ (mapcar #'slot-definition-name (slots-of object)))
+
+(defun slots-of (object)
+ "List of slots of OBJECT."
+ (class-slots (class-of object)))