Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
How to convert pools into modules
Last updated at 4:38 pm UTC on 16 January 2006
Andreas Raab wrote:


Those classes that already use pools should continue to work fine until you recompile pool-referring code–I don't actively destroy existing pools. But creating classes that use pools wouldn't work anymore.

And to be able to recompile (former) pool using classes you need to

A) convert their pools into (pool) modules.

B) Convert existing code that accesses the pool dictionaries directly. This is typically only pool intialization code (unless you write naughty self-modifying code or some such ;-).

To do A you create a subclass of ModuleRefactorer, and fill in the info by overriding #newModulesForPools. Search for the existing implementor of that message to see how to do this. Check ModuleRefactorer 'convert pools' category to see the code that does this (but you shouldn't need to know how it is done). You run this code by executing "TheRefactorerClass run". Save the image before running that–you'll probably need a couple of tries to get it right.

To do B, you change the pool initialization code that sets up the pool vars to define them as vars in the pool module instead. The CS released as update 4681 holds the code that converts the necessary code in the standard image. That CS should be a good reference point for doing this, it holds conversions both for simple pool init code and for some more naughty code.


Right, I intentionally did not imitate the Dictionary protocol.


There is unfortunately no simple way to do any automatic conversion, but simple pool initialization code should be simple to convert.

A possible solution is to make pools fileIn-able again. It would mainly mean putting back pool lookups in the code that binds upper case variable names to values. It's on my list (though a list of what, I don't know).

But you won't be able to use this code as proper module code anyway as pools break modularity.

Henrik