Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Useful module code snippets
Last updated at 5:09 pm UTC on 16 January 2006
Some useful code snippets (especially for refactoring):

How to find the module of a class or any global:

Module root modulesDefining: #TestTMethod  
a Dictionary(#(Squeak VMConstruction Plugins Test)->TestTMethod )

To get all the references from all other modules to one module (here TranslationToC) :

| aModule| 
aModule := Module @ #(Squeak VMConstruction TranslationToC).
aModule deepIncomingRefsFromOutside: aModule 

To get all the references from all other modules (except all the modules belonging to the parent of one module (here TranslationToC parentModule) :

| aModule| 
aModule := Module @ #(Squeak VMConstruction TranslationToC).
aModule deepIncomingRefsFromOutside: aModule parentModule

Because here you want to unload the VMConstruction as a whole.

To automatically generate delta modules holding class extensions.

Here we want to have as delta module associated with TranslationToC all the class extensions made rest in the system. But we do not want to get the references from the classes inside VMConstruction.
| aModule| 
aModule := Module @ #(Squeak VMConstruction TranslationToC).
aModule defineClassExtensionsOutside: aModule parentModule

How to automatically declare dependencies for all the modules that a module is depending on

Module @ #(Squeak VMConstruction) deepDeclareExternalRefs.