[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changing the :INITFORM of a slot with :ALLOCATION :CLASS



My CLOS classes often have associated with them various parameters which
are not per-instance but merely per-class.  In Flavors I simply used
DEFVAR or DEFPARAMETER to define such a variable or parameter, but with
CLOS I would prefer to tie the variable/parameter more tightly to its
class by defining it as a slot with :ALLOCATION :CLASS.  My difficulty
is that once such a slot has been defined and initialized via :INITFORM,
the slot's value is frozen forever (unless explicitly modified via an
ad-hoc SETF).  That is, simple re-evaluation of the class definition
with a different :INITFORM does not alter the slot's value.  Only if I
remove the slot (or change its allocation mode), then put it back again,
is the slot reinitialized.  My understanding of the CLOS spec is that
this is indeed the required behavior.  But isn't there any way to get
the behavior 1I0 want (modification of the slot's value when redefined
with a different :INITFORM)?  Or is this simply the wrong application of
:ALLOCATION :CLASS?

Note that Common Lisp specifies for DEFVAR the same style of behavior.
That is, re-evaluation of a DEFVAR with a new initializer is not
supposed to modify the variable's value, but Symbolics' implementation
does so anyway (and thankfully so, in my opinion), albeit with a
warning.


	Lawrence G. Mayka
	AT&T Bell Laboratories
	lgm@iexist.att.com

Standard disclaimer.