The ':isnew' message selector causes an instance to run its initialization method. If an ':isnew' message is sent to a class, the class definition and state will be reset as specified in the arguments of the message.
(setq a-class (send class :new '(state))) ; create a new class A-CLASS with STATE
(send a-class :answer :isnew '() ; set up initialization
'((setq state nil) self))
(send a-class :answer :set-it '(value) ; create :SET-IT message
'((setq state value)))
(setq an-obj (send a-class :new)) ; create AN-OBJ out of A-CLASS
(send an-obj :show) ; returns object - STATE = NIL
(send an-obj :set-it 5) ; STATE is set to 5
(send an-obj :show) ; returns object - STATE = 5
(SEND an-obj :ISNEW) ; re-initialize AN-OBJ
(send an-obj :show) ; returns object - STATE = NIL
See the
:isnew
message selector in the