PoolDictionary handling (was Re: [ANN] "Upgrade to 3.6 Full
Image" package on SqueakMap)
Andreas Raab
andreas.raab at gmx.de
Sat May 17 12:43:36 UTC 2003
Tim, Stef,
Attached is my proposed solution to this problem. It consists of two parts:
#1: Radically changing the name lookup protocol to use #bindingOf: (and only
#bindingOf:). The attached changes do this without breaking anything as a
fallback-implementation of #scopeHas:ifTrue: has been left in Behavior.
Now we can use any object as name space imported to a class (e.g., 'pool)
which - incidentally - means that other classes can act as a pool
themselves. Bringing us to
#2: Use class variables for 'declarative pools'. In other words, make up a
class like:
Object subclass: #MyPool
instanceVariableNames: ''
classVariableNames: 'PoolVar1 PoolVar2'
poolDictionaries: ''
category: 'My Pools'
and then
MyPool class>>initialize
"Initialize the pool"
PoolVar1 := 123.
PoolVar2 := #mumble.
Now you can use 'MyPool' as a pool dictionary wherever you want, e.g.,
Object subclass: #MyClass
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: 'MyPool'
category: ''
I've attached an example to show you how this feels. While I'm not saying
that one has to use the above style it certainly solves the problem of
managing pools in a more declarative way and combines both 'home' and
'initialization' of pools. And no more 'do you want to file out any pools
bla bla bla' ;-) It's just a regular dependency.
Cheers,
- Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BindingOf-Init.1.cs
Type: application/octet-stream
Size: 1860 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030517/8955dd5d/BindingOf-Init.1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: BindingOf-Cleanup.1.cs
Type: application/octet-stream
Size: 10551 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030517/8955dd5d/BindingOf-Cleanup.1.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: B3DPoolTest.st
Type: application/octet-stream
Size: 1322 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030517/8955dd5d/B3DPoolTest.obj
More information about the Squeak-dev
mailing list
|