[BUG] ClassBuilder cannot change class to variable subclass

ducasse ducasse at iam.unibe.ch
Mon Jan 5 08:26:32 UTC 2004


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?

If this is the case we should really document that.

Stef


On 5 janv. 04, at 02:36, Boris Gaertner wrote:

> From: Boris Gaertner <Boris.Gaertner at gmx.net>
> To: <squeak-dev at lists.squeakfoundation.org>
> Sent: Sunday, January 04, 2004 7:00 PM
> Subject: [BUG] ClassBuilder cannot change class to variable subclass
>
>
>> This bug report is for Squeak 3.7 alpha latest update: 5623
>    <details omitted>
>> Attached you find a proposal for a fix. I think that it
>> will not cause problems elsewhere but your advice
>> is very welcome.
>
> That proposed fix is also wrong, attached you find something
> better.
>
> The iteration method 'withAllSubclassesDo:' that I called a
> troublemaker, does two tests:
>  1. It checks the new number of named instance variables.
>  2. It validates the subclasses.
>
> The first test is needed for  oldClass and all subclasses,
> the second test is needed only for the subclasses.
> In the attached proposal, I do the first test for  oldClass
> before I do both tests for all the subclasses.
>
> It is helpful to compare with Squeak 3.4 #5170, where
> two iterations are used to keep the tests separate:
>
> (di 11/24/1999)
>    < ... >
>  oldClass withAllSubclassesDo: [:sub |
>   sub instSize + deltaSize > 254 ifTrue: [
>    self error: sub name,' has more than 254 instance variables'.
>    ^ false]].
>  newType ~~ #normal ifTrue:
>   ["And check if the immediate subclasses of oldClass can keep its 
> layout"
>   oldClass subclassesDo:[:sub|
>    oldType _ sub typeOfClass.
>    oldType == newType ifFalse: [
>     self error: sub name,' cannot be recompiled'.
>     ^ false]]].
>   < ... >
>
> Later these two iterations were merged into one  and that was
> wrong: The two iterations do not iterate over the same
> collection of classes! The first iteration checks one class that
> is not checked by the second iteration.
>
>
>
>> Greetings, Boris
> <ClassBuilderCheck-bg.3.cs>




More information about the Squeak-dev mailing list