Hi Uko, On Wed, Mar 19, 2014 at 3:26 PM, Yuriy Tymchuk <yuriy.tymchuk@me.com> wrote:
Can anybody tell me what is the difference between the class variable on the "instance side" definition and instance variable on the "class side" definition?
Thanks in advance. Uko
Class variables, as in classVariableNames: 'AClassVariable' are global variables in scope in all methods of the class and its subclass, instannce methods of the class and instance methods if the subclass. In the example, there is only one AClassVariable in the class. Class instance variables are instance variables in the class object. The class object inherits from Behavior, ClassDescription and Class, and hence already has the superclass, methodDict, format, instanceVariables, organization, subclasses, name, classPool, sharedPools instance variables (details depending on dialect). The instanceVariableNames: on the class side add to these, but they are per-instance, and so the class and each of its subclasses has one of these instance variables and hence each class can have its own value for it, just as the class and each of its subclasses have their own method dictionaries. Further, the class instance variable is only in scope in class methods. HTH, Eliot