[squeak-dev] Inconsistent HierarchyBrowser #setClass: behavior - a bug or a feature?

mail at jaromir.net mail at jaromir.net
Mon Dec 27 17:38:53 UTC 2021


Hi Chris, Marcel, all:

I expected the following two examples to behave consistently but sadly it's not the case:

This works as expected (do-it together or line by line):

browser := Browser fullOnClass: Process.
browser setClass: Context

But this one's broken (watch what happens when executing line by line):

browser := HierarchyBrowser fullOnClass: Process.
browser setClass: Context

The culprit is the check "centralClass ifNil: [ aClassOrTrait ]" in HierarchyBrowser >> #setClass:

HierarchyBrowser >> setClass: aClassOrTrait
	self initHierarchyFor: (centralClass ifNil: [ aClassOrTrait ]).
	super setClass: aClassOrTrait

The check leaves the old centralClass intact instead of letting it be replaced with aClassOrTrait.

Chris (cmm) has introduced the change in Tools-cmm.812.mcz (http://forum.world.st/The-Trunk-Tools-cmm-812-mcz-td5076175.html). I believe there was a good reason but I can't figure out what the "centralClass ifNil: [ aClassOrTrait ]" is for... and wonder, is the check still necesary? :)

With the preceding version (below) without the check the above examples behave as expected - i.e. updating Hierarchy Browser correctly.

HierarchyBrowser >> setClass: aClassOrTrait
	self initHierarchyFor: aClassOrTrait.
	super setClass: aClassOrTrait

With the current version however, updating Hierarchy Browser needs to be done differently (via #initHierarchyFor:) than for Browser which spoils the polymorphism a bit.

Chris, I'd very much appreciate your help if you by any chance remembered why you introduced the check :) Many thanks!

Best,


~~~
^[^    Jaromir

Sent from Squeak Inbox Talk


More information about the Squeak-dev mailing list