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

CLOS question (or bug?)

Unknown Microsoft mail form. Approximate representation follows.

From: Danny Brewer on Tue, Nov 5, 1991 9:13 AM
Subject: CLOS question (or bug?)
To: info-mcl@cambridge.apple.com

The following CLOS behavior is an inconvenience, if not a bug.  First define a
simple class with a "constant" whose value the same for all instances and is
not intended to change.  It makes sense to store this slot in the class rather
than the instances.

   (const1      :READER     A-Const1
                :INITFORM   123
                :ALLOCATION :CLASS)

   (var1        :ACCESSOR   A-Var1
                :INITARG   :var1)
   (var2        :ACCESSOR   A-Var2
                :INITARG   :var2)

Now I make two instances and test them.

(SETF instance1-A (MAKE-INSTANCE 'A :var1 "meow" :var2 "mix"))
(SETF instance2-A (MAKE-INSTANCE 'A :var1 "giddy" :var2 "gat"))

Later, during an interactive programming session, I decide that const1
shouldn't be 123 but should be 456.  So I re-select and enter the class
definition above, but with the corrected constant.

Now check the previously created instances...

(A-Const1 instance1-A)
(A-Const1 instance2-A)

And they still have their old values.  So I figure I must need to
reinstantiate them.

(SETF instance1-A (MAKE-INSTANCE 'A :var1 "meow" :var2 "mix"))
(SETF instance2-A (MAKE-INSTANCE 'A :var1 "giddy" :var2 "gat"))

Now to check...

(A-Const1 instance1-A)
(A-Const1 instance2-A)

And they STILL don't have the value of the new constant.  Please correct me
if I'm wrong, I'm new to CLOS, but I would consider this a bug.

By experimenting I've discovered that if I redefine the class WITHOUT the
:ALLOCATION :CLASS and then redefine it with :ALLOCATION :CLASS, the
new "constant" is immediately in effect without having to reinstantiate
the two instances.

But wait, that's not all...

On page 214 of the manual the description of WINDOW-UPDATE-CURSOR says that
"The default version simply sets the cursor to the result of calling the
generic function WINDOW-CURSOR on the window."  I think this should say
VIEW-CURSOR instead of WINDOW-CURSOR.  On the previous page the description
of VIEW-CURSOR says that it is called by WINDOW-UPDATE-CURSOR.

Page 215 says of SET-CURSOR that a cursor ID can be given, but this doesn't
seem to work for me.  For example, using SET-CURSOR with the ID of the
cross cursor from the system file doesn't work.

Why isn't *CROSS-CURSOR* defined along with *WATCH-CURSOR*, *I-BEAM-CURSOR*,