Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Unloading modules
Last updated at 7:05 pm UTC on 17 August 2020
Note: The Modules system referred to on this page (and incorporated in 3.3alpha) is no longer part of the mainline Squeak release.

2006

To unload a module and its submodules (delete them from the image), you use
   ModuleInstaller unload: myModule
This will check dependencies and protest if some other modules declare that they depend on any of the ones to unload.
However, there are often classes elsewhere in the image that hold references to classes in the modules you are unloading. To create DeltaModules that will unload these methods along with the modules whose classes they refer to, use this message:
    myModule defineClassExtensionsOutside: myModule

Make sure you have saved your module contents first, as unloading simply wipes the modules from the image.

See Storing modular code using module repositories.

Example: Unloading properly separable modules

See Progress report and to-do list for modularizing the image for the current status of the modules in the image.

Note that unloading always affects a module and its whole tree of submodules (and delta modules).

You can try:
  | module |
   module := Module @  #(Squeak VMConstruction).
   module defineClassExtensionsOutside: module
   ModuleInstaller unload: module
here,
   Module @  #(Squeak VMConstruction)
returns the module object for VMConstruction, as specified by the path to it.

You can also try
  | module |
   module := Module @  #(Squeak Media Balloon3D).
   module defineClassExtensionsOutside: module
   ModuleInstaller unload: module
This unloads Balloon3D, Alice, and Wonderland. This is because Alice and Wonderland are currently submodules of Balloon3D. You can also unload just Alice or Wonderland.

Note that either of these does not yet reload completely.