On 14.09.2008, at 16:19, Stéphane Ducasse wrote:
Hi
is there a way that I can trigger the recompilation of a class when its superclass changes? I tried
ComponentLikeModel subclasses do: [:each | each superclass: ComponentLikeModel superclass]
but I did not get the recompilation.
I think there is no easy way... normally all these mutations are done with the ClassBuilder (e.g. adding an instanceVariable, which requires to recompile all subclasses). directly setting superclass: seems a bit dangerous to me... e.g if I evaluate your code: ComponentLikeModel subclasses do: [:each | each superclass: ComponentLikeModel superclass] nevertheless, ComponentLikeModel subclasses --> {TwoWayScrollPane . ScrollPane} and TwoWayScrollPane superclass --> MorphicModel this is because calling superclass: does not fix the "subclasses", that is, the data is out of sync. this one looks better: ComponentLikeModel subclasses do: [:each | each superclass: ComponentLikeModel superclass. ComponentLikeModel superclass addSubclass: each. ComponentLikeModel removeSubclass: each]. But when I recompile the changed classes, it freezes the system: toRecompile := ComponentLikeModel subclasses. ComponentLikeModel subclasses do: [:each | each superclass: ComponentLikeModel superclass. ComponentLikeModel superclass addSubclass: each. ComponentLikeModel removeSubclass: each]. toRecompile do: [:cls | cls withAllSubclassesDo: [:each | each compileAll]] no idea.. to tired. maybe use the ClassBuilder? I think it's there precisely because mutating class structure is so easy to get wrong... Marcus -- Marcus Denker -- denker@iam.unibe.ch http://www.iam.unibe.ch/~denker