[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Questions: undefining stuff in MCL
- Subject: Questions: undefining stuff in MCL
- From: firstname.lastname@example.org (Bill St. Clair)
- Date: Mon, 17 May 1993 20:19:25 -0600
At 6:20 AM 5/17/93 +0000, Cecil Huang wrote:
>Thanks in advance for taking the time and trouble to help me out. I am
>a new MCL user and I have some basic questions about undefining entities
>in MCL. This is in the context of the following situations:
> 1. Suppose I'm in MCL and I want to wipe out all of the definitions
> I have created. Is there any way to do this without quitting MCL
> and restarting it? I notice that when I close the "listener" window,
> a new one appears, but it seems to "remember" everything from the
> previous listener window.
An MCL Listener is a user interface for the Common Lisp heap.
Neither the Common Lisp specification nor MCL provide a notion of UNDO
or any kind of transaction protocol for the Common Lisp heap.
> 2. In experimenting with OOP, I tried the following, in order:
>  (defstruct account (name "") (balance 0.00) (interest-rate .06))
> Later, I decided I wanted to do try this example in CLOS and define
> a class called account.
>  (defclass account ()
> ((name :initarg :name :reader name)
> (balance :initarg :balance :initform 0.00 :accessor balance)
> (interest-rate :allocation :class :initform .06
> :reader interest-rate)))
> I got the following error message, which suggests that somehow 
> prevented the successful execution of . (I confirmed this by
> restarting MCL and executing  only, and it succeeded.)
> > Error: #<STRUCTURE-CLASS ACCOUNT> is not an instance of
> #<STANDARD-CLASS STANDARD-CLASS>
> > While executing: CCL::%DEFCLASS
> > Type Command-/ to continue, Command-. to abort.
> > If continued: (CHANGE-CLASS '#<STRUCTURE-CLASS ACCOUNT>
> '#<STANDARD-CLASS STANDARD-CLASS>)
> See the RestartsI menu item for further choices.
> Can someone explain to me why this is happening and what I can do
> about it? (Could I "undefstruct" , for example?)
The CLOS spec does not in general allow a class'es metaclass to be
changed, though it does specify that this is an allowed extension
(CLtL2, section 184.108.40.206, p. 812). The AMOP is even weaker on this
point. It explicitly specifies this operation as having undefined
MCL signals an error to warn you that you are doing something unkosher,
but allows you to go ahead and perform the redefinition if you continue.
Typing command-/ will redefine the class, but it will not change the
class of any existing instances of #<STRUCTURE-CLASS ACCOUNT>.