chiark / gitweb /
src/utilities.lisp (defvar-unbound): Make a variable with docs and no value.
authorMark Wooding <mdw@distorted.org.uk>
Thu, 26 May 2016 08:26:09 +0000 (09:26 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 Jun 2018 18:58:28 +0000 (19:58 +0100)
doc/SYMBOLS
doc/misc.tex
src/utilities.lisp

index 43ed0f26456d730fcc4969cdcb6e4dd411708572..909f993dc8e30f10906b7639fd12fc431a1cbdaf 100644 (file)
@@ -2217,6 +2217,7 @@ utilities.lisp
   default-slot                                  macro
   define-access-wrapper                         macro
   define-on-demand-slot                         macro
+  defvar-unbound                                macro
   designated-condition                          function
   dosequence                                    macro
   sb-mop:eql-specializer                        class
index 2e7b504a056be18c98399295e96d91b35337a135..f6037e1a49ece74689a14cd52eb959229f4b2341 100644 (file)
@@ -172,6 +172,9 @@ These symbols are defined in the @|sod-utilities| package.
     {compose @<function> \&rest @<more-functions> @> @<function>}
 \end{describe}
 
+\begin{describe}{mac}{defvar @<name> @<documentation> @> @<name>}
+\end{describe}
+
 \begin{describe}{fun}{symbolicate \&rest @<symbols> @> @<symbol>}
 \end{describe}
 
index 72423fded8d86f7e26af1e4d022c6f6cd6c9d5c8..72af8b327138d908d86c6476e58f17f4bea0aa4f 100644 (file)
@@ -708,6 +708,17 @@ (defun compose (function &rest more-functions)
               (multiple-value-call func-b (apply func-a args)))))
     (reduce #'compose1 more-functions :initial-value function)))
 
+;;;--------------------------------------------------------------------------
+;;; Variables.
+
+(export 'defvar-unbound)
+(defmacro defvar-unbound (var doc)
+  "Make VAR a special variable with documentation DOC, but leave it unbound."
+  `(eval-when (:compile-toplevel :load-toplevel :execute)
+     (defvar ,var)
+     (setf (documentation ',var 'variable) ',doc)
+     ',var))
+
 ;;;--------------------------------------------------------------------------
 ;;; Symbols.