[BUG] ClassBuilder cannot change class to variable subclass

Boris Gaertner Boris.Gaertner at gmx.net
Mon Jan 5 20:04:15 UTC 2004

From: ducasse <ducasse at iam.unibe.ch>

> Hi boris
> When we started KCP, we were looking at withAllSubclassesDo: we realise 
> that the order of iterations
> could be really important. This is a non-functional requirement that is 
> fun but dangerous.
> I did not have the time to look at your changes now but I'm guessing 
> that the order is really important.
> Is my hypothesis true?
I think it is not.

I compared earlier versions of the ClassBuilder with the current one
and I think now, that both my proposals to fix the bug are bad.
My first proposal is wrong and my second one is bad because it
does unnecessary tests.  Let me explain this in greater detail.

As I wrote last night (Jan 04), an earlier version of 
used two iteration statements to keep two tests separate.
This is a very important point, but yesterday I failed to
fully understand it.

The first test checks the number of named instance variables.
This test is needed for the modified class and all its subclasses.
For this test the use of "withAllSubclassesDo:" is correct
and the order of the tests is irrelevant.

The second test verifies that, with the new format, oldClass
is general enough to be the superclass of its subclasses.
Here it is sufficient to check the direct subclasses. This 
is also said in the comment that survived the changes that
came with change set 5300:
 "And check if the immediate subclasses of
oldClass can keep its layout"
Here the use of "subclassesDo:" is sufficient and "subclassesDo:"
iterates over a collection that is often smaller than the collection
that "allSubclassesDo:" iterates over.
(It is not necessary to check the subclasses of the subclasses
because this was done for every subclass when it was defined
or modified for the last time.)

I think that we should go back to the use of two iteration statements.
The attached third proposal of a fix supersedes my two earlier
proposals. (The proposal was of course checked against the
tests that Andreas posted yesterday. Thank you, Andreas!)

I feel sorry that I needed three attempts and four mails to
come up with a reasonably good proposal, but the stuff
is really a bit tricky. Comments are therefore most welcome.

Greetings, Boris 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ClassBuilderCheck-bg.4.cs
Type: application/octet-stream
Size: 1688 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20040105/0eff7afc/ClassBuilderCheck-bg.4.obj

More information about the Squeak-dev mailing list