2014-08-29 13:38 GMT+02:00 Oscar Nierstrasz <[email protected]>:
> > Following up: > > Behavior new compile: 't ^ true’ > > fails since #compile: is defined in TBehavior and depends on > #basicLocalSelectors which is defined only in Class, MetaClass and > TraitBehavior. > > It seems like #basicLocalSelectors should be abstract in TBehavior. > Alternatively the implementation should be moved to TBehavior and the field > localSelectors should be pushed up to Behavior. Am I missing something? > Yep, I think you are right. Last year I did a lot of modifications in Behavior, TBehavior, Class, etc. These changes were made to make classes and traits polymorphic. If I remember correctly, the instance variable localSelectors was not moved to Behavior because it was not possible to push up that instance variable (there were a lot of errors since it is one of the core classes). If you look at the traits hierarchy, localSelectors is in TraitBehavior, not in Trait. So moving the instance variable localSelectors to Behavior and then abstract basicLocalSelectors in TBehavior would be very good > Oscar > > On 29 Aug 2014, at 12:26 , Oscar Nierstrasz <[email protected]> > wrote: > > > > > Hi folks, > > > > I was updating my lecture on Reflection for the Software Design and > Evolution course, and I see now that anonymous classes can no longer be > instances of Behavior but must be instances of Class. If you try to > compile a method on an instance of Behavior, it fails. > (basicLocalSelectors is not understood) > > > > Am I missing something? > > > > Cheers, > > Oscar > > > > testPrimitiveChangeClassTo > > | anonClass browser | > > > > anonClass := Class new. “must be Class, not Behavior" > > anonClass superclass: Browser. > > anonClass setFormat: Browser format. > > > > browser := Browser new. > > browser primitiveChangeClassTo: anonClass new. > > anonClass compile: 'thisIsATest ^ 2'. > > > > self assert: browser thisIsATest = 2. > > self should: [Browser new thisIsATest] > > raise: MessageNotUnderstood. > > > > > > >
