PoolDictionaries???

Bob Arning arning at charm.net
Fri Jul 21 18:09:57 UTC 2000


On Fri, 21 Jul 2000 13:38:20 -0500 jchludzinski at worldkey.net wrote:
>I've defined 2 classes with a poolDictionary ('P') (Squeak created 
>the poolDictionary for me).  I referenced/added to the dictionary 
>in the class methods.  But it appears that ANY class can now 
>reference 'P' without including it in the class definition!
>
>Is 'P' global?

Yes, the dictionary P is globally known.

>What's the value in placing 'P' in a class definition if it's 
>global and can be accessed with or without including in the class 
>definition?

The advantage is that methods in a class that has P in its definition may refer to values in the pool by their key. So, if P had an elements #One -> 1 and #Two -> 2, then a method in a class that named P could write

three

	^One + Two

Methods in classes that did not mention P could not do that, although they could write (P at: #One) + (P at: #Two).

>How do I view the defined poolDictionaries?

(Object allSubclasses inject: Set new into: [ :set :each | set addAll: each sharedPools. set]) explore

Cheers,
Bob





More information about the Squeak-dev mailing list