Blanchard, Tod wrote:
Could somebody explain PoolDictionary in the class definition pane? What are they and why would I want one? Thanks.
They are hashtables like Smalltalk. They hold named objects (named via the hash keys) that you might want to have free access to in some set of classes, but not have the namespace polluted where they aren't needed. An example is the set of Character constants stored in the global Dictionary (i.e. it's stored in Smalltalk) TextConstants. In here for example is an entry named 'Space' having a value of the space character (ASCII 32). If you use TextConstants as a PoolDictionary in a class then you have access to elements of that Dictionary as if they were class variables (i.e. you just have to reference 'Space' if you want the space character.
For an example in Squeak, look at the class CharacterBlockScanner in category Graphics-Support. It uses TextConstants as a pool dictionary. If you look in the 'cr' method in the 'stop conditions' protocol you can see reference to 'CR' which is an entry in TextConstants:
characterPoint _ ((text at: lastIndex) = CR ifTrue: [leftMargin] ifFalse: [nextLeftMargin])
I hope this helps.
Dave
squeak-dev@lists.squeakfoundation.org