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

shared slots, obsolete classes, dynamic slots




1. Are shared slots supposed to have initforms? If yes, when should 
they be evaluated?

2. The description of shared slots in CLOS looks as if there should
be only one cell for all instances of a class that defines this slot
and also for all instances of its subclasses. PCL defines a cell for 
the class and one for every subclass. Which is the correct 
interpretation?

(defclass a() ((s1 :allocation :class)))
(defclass b (a) ())

(setq i (make-instance 'a))
(setq j (make-instance 'a))
(setq k (make-instance 'b))

(setf (slot-value i 's1) 1)
(slot-value j 's1)  ;;; -> 1
(slot-value k 's1)  ;;; -> (*slotd-unsupplied*)

3. The patch that should fix the bug using slot-value of an
instance of class obsolete-class doesn't work. (Mail 29. April).
It just solves the problem with the infinite loop but still leaves
the changed instance incorrect.
Obsolete class is a copy of the new class instead of the old one.
Information of the old class isn't accessible anymore. As soon as
you don't just add new slots to the old class 
(i.e. you insert, delete, exchange the order of some slots) 
it can not work anymore.

(defclass c () (s1 s2))

(setq x (make-instance 'c :s1 1 :s2 2))

(defclass c () (s2 s1))

(slot-value x 's1)  ;;; ->2
(slot-value x 's2)  ;;; ->1

4. Last years Meta Object Protocol mentions operations on
dynamic slots. The new chapter 2 doesn't. Does that mean that
dynamic slots won't be supported in CLOS?

                     Angela
                     adf%ztivax.siemens.com@siemens.com