How to rename a lot of classes at once?

Todd Blanchard tblanchard at mac.com
Tue Dec 26 08:44:20 UTC 2006


I have a whole hierarchy of classes with some prefix AA.  I generated  
a clone of the hierarchy with a prefix like BB.

Now I am happy with the changes I've made to BBClass and want to  
replace the AAClass hierarchy with the BBClass hierarchy by deleting  
the AAClasses and renaming BBClasses to AAClasses.  This is my script:

| list bbDict |
list := AAClass withAllSubclasses asArray.
bbDict := Dictionary new.
list do: [:ea | bbDict at: ea bbClass put: ea name].
list do: [:cls | Smalltalk removeClass: cls].
bbDict keysAndValuesDo:[:k :v | Smalltalk renameClass: k as: v].

This doesn't seem to properly complete the job and leaves  
SystemDictionary and the new AAClasses in a weird state.

What am I missing?

-Todd Blanchard



More information about the Squeak-dev mailing list