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

Inheritance of Slots

Moon writes:

``Third, when compiling a method you cannot assume anything about the types of
the slots, since a subclass could throw away your :type slot-option.''

I guess I didn't say it clearly enough. The effective type of a slot
is the AND (as in (AND T1 T2 ... Tn)) of the slots in the CPL. I thought
this was exactly what this meant:

``{\bf :type} is constrained to satisfy all of the type constraints given
by classes in the class precedence list.  That is, if T1, T2 and so on are
the type constraints given by the class and all of its superclasses, the
value of the slot must satisfy {\bf (typep value '(and T1 T2 T3...)}.''

Didn't you (Moon) and Sonya write this?

Moon comments:

``No net gain.''

Before there were these categories of slot inheritance:

	1. accessors and readers don't specially inherit

	2. :allocation inherits some funny way

	3. :initform inherits some other funny way

	4. :type inherits by doing AND

Now we have:

	1. accessors and readers as above

	2. :allocation, :initform, and :type are totally
	   inherited or totally shadowed with simple defaults.

	3. :type constrained to be AND.

Moon writes:

``In addition, I'm not happy about the idea that one cannot define an
:accessor for an inherited slot without clobbering its :initform.''

I thought my proposal said that if you mention slot options only
(:accessor, for example) normal inheritance happens. The simplified
rule is for slot descriptions only (:allocation, :type, :initform).
If you had :accessor only, the slot description stuff is totally
inherited - ``the right thing.'' If you mention a slot description,
all slot descriptions are shadowed. To be specific, the following
statement is true:

``one *can* define an :accessor for an inherited slot without clobbering
its :initform as long as :type and :allocation are not mentioned in the
defclass form.''

I think that the briarpatch of inheritance rules surrounding :allocation,
:type, and :initform are too complex.