[comp.lang.smalltalk] adding instance variables to a class

cohill@vtserf.cc.vt.edu (Andrew M. Cohill) (03/24/90)

I am struggling with Smalltalk/V, and I am continually stymied because
I do not seem smart enough to specify all the instance variables that
I need for a class definition at the time I create the class, and you
can't seem to add them once the class has been defined.  Is this a
common problem?  Or am I just dumb?

benson@blake.acs.washington.edu (Dan Benson) (03/24/90)

In article <1356@vtserf.cc.vt.edu> cohill@vtserf.cc.vt.edu.UUCP (Andrew M. Cohill) writes:
>I am struggling with Smalltalk/V, and I am continually stymied because
>I do not seem smart enough to specify all the instance variables that
>I need for a class definition at the time I create the class, and you
>can't seem to add them once the class has been defined.  Is this a
>common problem?  Or am I just dumb?

You sound like a normal Smalltalk programmer to me.  I don't think anyone
thinks of all instance variables for a class the first time it's
designed.  But that's one of the nice things about the Smalltalk
environment - you can modify it relatively easily.  One problem with
changing the class definition (other than adding and deleting methods)
is that Smalltalk won't like it if there exists instances of the class
you're trying to change.  In Smalltalk/V you'll get the message,
"has instances", so you'll have to first get rid of all existing
instances and then try saving the changes to your class definition.

-- 
| Dan Benson                        benson@ee.washington.edu    |
| Dept. of Elec. Engr., FT-10                                   |
| University of Washington          (206) 685-7567              |
| Seattle, WA  98195                                            |