[Pharo-project] superclass:
Hi is there a way that I can trigger the recompilation of a class when its superclass changes? I tried ComponentLikeModel suclasses do: [:each | each superclass: ComponentLikeModel superclass] but I did not get the recompilation. Stef
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
On 15.09.2008, at 00:24, Marcus Denker wrote:
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.
no idea.. to tired. maybe use the ClassBuilder? I think it's there precisely because mutating class structure is so easy to get wrong...
Why not just do: MorphicModel subclass: #ScrollPane instanceVariableNames: 'scrollBar scroller retractableScrollBar scrollBarOnLeft getMenuSelector getMenuTitleSelector scrollBarHidden hasFocus hScrollBar' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Windows' MorphicModel subclass: #TwoWayScrollPane instanceVariableNames: 'getMenuSelector getMenuTitleSelector xScrollBar yScrollBar scroller' classVariableNames: '' poolDictionaries: '' category: 'MorphicExtras-Obsolete' this then calls the ClassBuilder to do the migrations. works for me. Marcus -- Marcus Denker -- denker@iam.unibe.ch http://www.iam.unibe.ch/~denker
Ye this is is what I tried also. On Sep 15, 2008, at 12:31 AM, Marcus Denker wrote:
On 15.09.2008, at 00:24, Marcus Denker wrote:
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.
no idea.. to tired. maybe use the ClassBuilder? I think it's there precisely because mutating class structure is so easy to get wrong...
Why not just do:
MorphicModel subclass: #ScrollPane instanceVariableNames: 'scrollBar scroller retractableScrollBar scrollBarOnLeft getMenuSelector getMenuTitleSelector scrollBarHidden hasFocus hScrollBar' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Windows'
MorphicModel subclass: #TwoWayScrollPane instanceVariableNames: 'getMenuSelector getMenuTitleSelector xScrollBar yScrollBar scroller' classVariableNames: '' poolDictionaries: '' category: 'MorphicExtras-Obsolete'
this then calls the ClassBuilder to do the migrations. works for me.
Marcus
-- Marcus Denker -- denker@iam.unibe.ch http://www.iam.unibe.ch/~denker
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (2)
-
Marcus Denker -
Stéphane Ducasse