Path: utzoo!yunexus!ists!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!apple!well!mitsu From: mitsu@well.UUCP (Mitsuharu Hadeishi) Newsgroups: comp.lang.smalltalk Subject: Re: ST V/286 a few questions... Message-ID: <14621@well.UUCP> Date: 19 Nov 89 01:02:13 GMT Article-I.D.: well.14621 References: <441@DB0TUI11.BITNET> Reply-To: mitsu@well.UUCP (Mitsuharu Hadeishi) Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 21 To add an instance variable to a class with a lot of distributed members, I've thought of doing this: create a duplicate of the class with dummy instance variables that takes an instance of the class you're modifying and copies all the instance variables (using the primitive methods in class Object). The do an OriginalClass allInstances and iterate through the collection, and for each one do "object become: (DummyClass new: object)". Then add the instance variable to your original class, which now no longer has any instances. Finally, reverse the process. I've never tried it, and it looks risky, but somehow I think it will work, provided you don't try to use the class while you're modifying it. If you need to use the class, all you need to do is actually duplicate the class (instead of just making a dummy class), i.e., file it out, edit the filed out class to change the name to whatever (OriginalClassDup), then file *that* class in. Then add the class method to dup the class, and go through the above procedure. Would this work? It's seems like it should, but who knows.