[Q] mixin pattern - how to use an alternate Behavior for Class
Nathanael Schärli
n.schaerli at gmx.net
Tue Jan 29 07:12:46 UTC 2002
> you said:
> > In case (1a) you break this parallel inheritance hierarchy because
> > 'MixinClass' is a subclass of
> > 'ClassDescription' but 'MixinClass class' is no subclass of
> > 'ClassDescription class' (in fact,
>
> this is not true, 'MixinClass class' is a subclass of 'ClassDescription
> class'.
>
> > 'MixinClass class' == 'MixinClass'). In your concerte
> > example, this means
> > that 'MixinClass' inherits
> > from:
> >
> > ClassDescription
> > Behavior
> > Object
> > ProtoObject
> >
> > but 'MixinClass class' (== 'MixinClass') does not inherit from
> > 'ClassDescription class', 'Behavior
> > class', etc.
>
> again this is not true.
>
> Here is my option (1b)
> > > 1a) meta _ Metaclass new.
> > > meta
> > > superclass: MixinClass
> > > methodDictionary: MethodDictionary new
> > > format: MixinClass format.
> > > newClass _ meta new.
> > > 2) newClass
> > > superclass: newSuper
> > > methodDictionary: MethodDictionary new
> > > format: newFormat;
> > > contextClass: aContextClass;
> > > setInstVarNames: instVars;
> > > organization: nil.
> > > ^newClass
Rob,
Yes, you are right! I didn't read the example right! You define here a new
class (not MixinClass) which has MixinClass as the superclass of the
metaclass. Therefore, the parallel inheritance chains break for this new
class and not for MixinClass.
Nathanael
More information about the Squeak-dev
mailing list
|