[comp.lang.smalltalk] Meta Class "inst var"?

sticken@pleiades.cps.msu.edu (06/11/91)

I am getting confused on the purpose of the meta class instance variable slot.
(The one I am looking at when I get a class in the SystemBrowser, and click the
"class" selection.)

What is the purpose of this construct? My first guess was that when I fill in a
name in the "class instance var" list, that this would show up as class
variables in the regular class (and its subclasses). In other words...



   ....                  ...
     |                    |
    Foo                  Foo class   (the meta of Foo...)
     ClassVars             InstVars
     InstVars             

  

I thought when I wrote into (Foo class) a new InstVar, that I would get
automatically a new ClassVar in Foo, and its subs. That clearly is not what I
am getting. 

Can someone enlighten me please?

Thanks,

   ---jon---

graver@gull.cis.ufl.edu (Justin Graver) (06/12/91)

In article <1991Jun11.145458.15123@msuinfo.cl.msu.edu> sticken@pleiades.cps.msu.edu writes:
>I am getting confused on the purpose of the meta class instance variable slot.
>(The one I am looking at when I get a class in the SystemBrowser, and click the
>"class" selection.)
>
>What is the purpose of this construct? 


All object may have private instance variables.  Classes are objects so
they may have private instance variables, too.  Using the template:

	Foo class
		instanceVariableNames: 'varA varB'

allows one to declare instance variables for class objects.  Although
subclasses will inherit these definitions, this class and each of its
subclasses will have their own private value for the instance variables.
Class variables, on the other hand, are references to a single object
which are *shared* by a class, its subclasses, and all of their instances.

Hope this helps.

	Justin Graver
	graver@ufl.edu
	University of Florida