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?
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.
>
>