Make list-all-slots public.

This commit is contained in:
Kyle 2015-11-05 10:28:58 -08:00
parent 5bb8215444
commit b3aafb4a8a
3 changed files with 12 additions and 3 deletions

View File

@ -285,6 +285,10 @@ resulting string to @c(path). Any remaining arguments are sent to
The package @c(kutils-mop) contains utilities taking advantage of the The package @c(kutils-mop) contains utilities taking advantage of the
metaobject protocol. metaobject protocol.
The @c(list-all-slots) will return a list of all slots in an object.
@cl:with-package[name="kutils-mop"](
@cl:doc(function list-all-slots))
The @c(make-instance-from-hash-table) function will attempt to create The @c(make-instance-from-hash-table) function will attempt to create
an instance of an object from a hash table. an instance of an object from a hash table.
@ -391,6 +395,9 @@ utilities".)
described in "Miscellaneous utilities" under "Clojure-inspired described in "Miscellaneous utilities" under "Clojure-inspired
functions".) functions".)
@item(@c(list-all-slots) is a function defined in @c(kmop/kmop.list),
described in "Metaobject utilities".)
@item(@c(macroexpand-n) is a function defined in @c(kutils.lisp), @item(@c(macroexpand-n) is a function defined in @c(kutils.lisp),
described in "Miscellaneous utilities" under "General".) described in "Miscellaneous utilities" under "General".)
@ -503,6 +510,7 @@ Alphabetical documentation for all exported symbols.
@cl:doc(macro iflet*) @cl:doc(macro iflet*)
@cl:doc(macro in) @cl:doc(macro in)
@cl:doc(function interpose) @cl:doc(function interpose)
@cl:doc(function list-all-slots)
@cl:doc(function macroexpand-n) @cl:doc(function macroexpand-n)
@cl:doc(macro mapv) @cl:doc(macro mapv)
@cl:doc(function mkkw) @cl:doc(function mkkw)

View File

@ -30,7 +30,7 @@
(mapcar #'closer-mop:slot-definition-initargs slots))) (mapcar #'closer-mop:slot-definition-initargs slots)))
(defun get-all-slots (class-sym &optional (package *package*)) (defun list-all-slots (class-sym &optional (package *package*))
(let ((class-val (find-class (let ((class-val (find-class
(find-symbol (find-symbol
(mkstr class-sym) (mkstr class-sym)
@ -89,6 +89,6 @@ should use underscores. The slot type is used to determine whether
to attempt to parse another object as a hash table entry." to attempt to parse another object as a hash table entry."
(whenlet ((class-sym (class-symbol class-type)) (whenlet ((class-sym (class-symbol class-type))
(arglst (zip-initargs-hash-table (arglst (zip-initargs-hash-table
(get-all-slots class-type package) (list-all-slots class-type package)
table snake-case))) table snake-case)))
(apply #'make-instance class-sym arglst))) (apply #'make-instance class-sym arglst)))

View File

@ -2,4 +2,5 @@
(defpackage #:kutils-mop (defpackage #:kutils-mop
(:use #:cl #:kutils) (:use #:cl #:kutils)
(:export #:make-instance-from-hash-table)) (:export #:make-instance-from-hash-table
#:list-all-slots))