[BUG] [FIX] class-side inst var def'n (was RE: deficience in Squeak)

Scott Wallace scott.wallace at squeakland.org
Sat Nov 22 06:03:38 UTC 2003


At 2:47 AM +0100 11/22/03, Andreas Raab wrote:
>  > Recently I defined a class X and gave it a class instance variable. A
>>  message popped up saying something like "X is an existing class in the
>>  system, changing it is not recommended. Proceed anyway?".
>>  Turns out there was nothing special going on anyway (at least not that
>>  I've noticed).
>
>What it means is that you were defining a NEW class where one with the same
>name already existed in some other category. Typically this is a lethal
>problem - I would go sofar as to claim that the browser shouldn't allow this
>at all. What you're doing in this case is dumping an existing class
>definition because there's no way for you to see that class' definition at
>the point where you change it.

Of course Andreas is correct about the general point here.

However, what's showing up in the particular case that Ye Yuan 
mentioned at the start of this thread is in fact an actual and 
long-standing bug that shows up whenever you try redefine a 
class-instance-variable structure on the class side of a browser.

The problem is that the code doing the checking (in Browser method 
#defineClass:notifying:) is not being smart enough about metaclasses, 
with the result that the warning message is put up spuriously 
*whenever* you try to define class-instance variables, even when the 
browser is in fact appropriately pointed at the class being redefined.

The attached sets purport to fix the bug;  I attach two versions -- 
one (classWarnFix36-sw.cs) suitable for Squeak up through 3.6 
(including 3.2, 3.4, and 3.5,) and a separate one 
(classWarnFix37-sw.cs) for 3.7.

With this fix, the warning is still put up when there is a legitimate 
justification, but the spurious warning when the user changes the 
class-instance-variable structure of a class in a browser that is in 
fact pointed at that class is now eliminated.

Cheers,

   -- Scott
-------------- next part --------------
Skipped content of type multipart/appledouble-------------- next part --------------
Skipped content of type multipart/appledouble


More information about the Squeak-dev mailing list