From: Mark Wooding Date: Thu, 26 May 2016 08:26:09 +0000 (+0100) Subject: src/utilities.lisp (defvar-unbound): Make a variable with docs and no value. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/sod/commitdiff_plain/c34b237da0bb4bf08a3531a2e11442623df7e9d4?hp=dc162ca6f0f2bbcb045a03df61c76e37c48d85a7 src/utilities.lisp (defvar-unbound): Make a variable with docs and no value. --- diff --git a/doc/SYMBOLS b/doc/SYMBOLS index 43ed0f2..909f993 100644 --- a/doc/SYMBOLS +++ b/doc/SYMBOLS @@ -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 diff --git a/doc/misc.tex b/doc/misc.tex index 2e7b504..f6037e1 100644 --- a/doc/misc.tex +++ b/doc/misc.tex @@ -172,6 +172,9 @@ These symbols are defined in the @|sod-utilities| package. {compose @ \&rest @ @> @} \end{describe} +\begin{describe}{mac}{defvar @ @ @> @} +\end{describe} + \begin{describe}{fun}{symbolicate \&rest @ @> @} \end{describe} diff --git a/src/utilities.lisp b/src/utilities.lisp index 72423fd..72af8b3 100644 --- a/src/utilities.lisp +++ b/src/utilities.lisp @@ -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.