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 declare module dependencies
Last updated at 4:39 pm UTC on 16 January 2006

To declare that a module depends on another module, use the following message:
    module 
        externalModule: moduleOrPath 
        alias: aliasOrNil 
        version: versionOrNil 
        importNames: shouldImport
so:
    module 
        externalModule: Module @ #(Squeak Morphic) 
        alias: #Morphic 
        version: nil     "use any version available"
        importNames: true
is a typical message. These messages are for example used in module .def files to declare such dependencies when a module is loaded. If you imagine a graph of all modules in the image, this message creates a link in this graph from you module to the one you declare that it uses. This link is a ModuleReference object.
If you provide a path instead of an actual module as the first argument, then you need to send the message #resolveModule to the object that is returned (the ModuleReference). This will resolve the path into the module it corresponds to:
    (module externalModule: #(Squeak Morphic) alias: ...)
            resolveModule
(This allows you to create links to modules that do not yet exist in the image, since the link you create will only try to connect to the other module when you send the message #resolveModule. This capability is needed by the module loading mechanism.)
See also How to reference names defined in other modules.