[Newbies] invoking a *class* method from a workspace

Bert Freudenberg bert at freudenbergs.de
Sun May 27 16:14:06 UTC 2007


On May 27, 2007, at 17:14 , subbukk wrote:

> Since classes are also objects
> that are created when you 'accept' the definition (except that its  
> variables
> are created from classVariableNames), so you can use them in class  
> methods
> immediately.

Not quite. Those variables are "class variables", which are global  
variables (global to the class and subclasses and all their  
instances). Their names start with a capital letter like every global  
variable in Smalltalk.

> Like Bert explained in an earlier mail, use of classVariables is
> very rare.

There is a difference between "class variables" (which are like  
"static" variables in other systems, so they get their fare share of  
use) and "class instance variables" (very rarely used indeed). You  
see "class instance variables" only when you switch the browser to  
the class side. "Class instance variables" have a different value in  
each subclass and are private to the class-side. Hence they are not  
global and have lower-case names.

- Bert -




More information about the Beginners mailing list