[BUG] Class renaming

Phil Hargett hargettp at mindspring.com
Wed Nov 12 12:04:07 UTC 2003


I could be missing something, but I found myself very confused 
yesterday when I attempted to use Class>>rename: to rename some classes 
in one of my projects.  Since I needed to change the suffix on more 
than a dozen classes, I figured doing this programmatically would be 
the simplest, so I write a small line of code that created a collection 
of my classes, then invoked #rename: on each one with the new name.

However, what I found is that after the renaming, the Class instances 
themselves had not changed their names!  If I viewed the class in the 
Browser, the name in the Class pane was correct (the new name), but the 
class name listed in the class definition was the old one!  Further, if 
I examined the SystemDictionary had stored at the symbolic name for the 
class I discovered that a class was stored there that reported the 
*old* name for the class.

Best as I can gather by looking at the versions of the Class>>rename: 
method, in changeset 5457 (Squeak 3.7 alpha), a ClassRenameFix was 
applied that dropped any assignment to the Class's name instance 
variable.  Whereas prior to that change the last line of the method 
read name := newName, no such assignment occurs now.  Further, I could 
find no such assignment or invocation of Class>>setName:, the private 
method for performing that assignment.  Oh, and I tried renaming a 
class through the browser, and it has the same effect: renames the 
class in SystemDictionary and SystemOrganization, but doesn't rename 
the Class object itself.

If there's some background housekeeping task that updates names (and I 
missed it) that's great; would love the education.  Otherwise, I think 
we have a bug.




More information about the Squeak-dev mailing list