[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
defvar, defparameter, :unbound
Date: Tue, 5 Nov 85 12:53 EST
From: Guy Steele <gls@THINK-AQUINAS.ARPA>
Date: Mon, 4 Nov 85 23:18:59 EST
From: "Glenn S. Burke" <GSB@MIT-MC.ARPA>
From: Daniel L. Weinreb <DLW@SCRC-QUABBIN.ARPA>
Date: Sat, 2 Nov 85 23:55:45 EST
From: Nick Papadakis <firstname.lastname@example.org>
On the lispmachines, defvar will take a second argument of :unbound,
meaning that the variable will be initialized to an unbound state.
I'm not sure which Lisp machine this message is supposed to apply to,
but just for the record, the Symbolics system does not do this.
This hack was added to NIL. My personal feeling is that the special
case value is just asking to screw some poor user whose code just
happens to naively use :UNBOUND to mean something... But i added the
defvar hack anyway, because the ability to do both the defvar and
specify the documentations string in a single form seemed worth it.
(setf (documentation '*foo* 'variable) "Documentaiton string")
looks pretty crufty. Keyworded defvar, anyone?
One idea that was discussed previously was
(defvar *foo* *foo* "Documentation string")
which self-evidently means "declare *foo* and initialize to its existing
value", but by special dispensation it arranges to work even when *foo*
is already unbound, i.e., it leaves it alone. This is fine for DEFVAR,
but is less appealing for DEFPARAMETER.
Recall that DEFPARAMETER's initial value is not optional, with implied
(perhaps stated) semantics that it must always have a value.