[Morphic][Preferences] Some note on Preferences parameteres dictionary

Doug Way dway at riskmetrics.com
Mon Mar 18 22:31:10 UTC 2002


hannes.hirzel.squeaklist at bluewin.ch wrote:
> 
> Martin Drautzburg <martin.drautzburg at web.de> wrote:
> 
> >
> > Preferences and Parameters
> >
> >         There is a class "Preferences" that answers various questions,
> >         like "Window color". It sometimes seems to decide that itself
> >         and sometimes it looks things up in "Parameters". Now what is
> >         this "Parameters". Syntactically it looks like a Class or a
> >         global Variable, but it is neither the one nor the other.
> 
> It is a so called class variable.

As Hannes says, it is a "class variable".  As opposed to an "instance variable".

A class variable is a global-like variable attached to the class, shared among all instances.  For example, the class Color has an instance variable "rgb", which every instance of color has a different value for, but it also has a class variable "RedShift", which is the same for all instances.  You can inspect the class "Color" directly and look in its classPool to see what the value of the class variable is.  (It's equal to "20" in my image.)

In the class definition page of a browser (the text that appears when you select a new class), you'll see that you declare your class variables along with your instance variables when you define a class.

(If you're familiar with Java or C++, class variables are basically equivalent to static variables (declared within a class) in Java/C++.)

This is basic Smalltalk-80 stuff... you might want to get a good Smalltalk-80 book or reference for more details on this, such as the Goldberg & Robson Smalltalk-80 "purple" book.  (I'm not sure if any Squeak-specific tutorials cover this.)

> The standard end-user way of dealing with the preferences is through
> 
> World menu>help>Preferences ....
> 
> (Side remark: It should be better moved up to the World Menu some time)

That's not a bad idea.  Of course, the World menu is already somewhat large and we should be careful about what we add to it.  But there's a lot of stuff in Preferences now, and it seems like it might be worth making it readily accessible to a newcomer.  (Or maybe have it in a more specific submenu than "help...".)

- Doug Way
  dway at riskmetrics.com



More information about the Squeak-dev mailing list