Next: , Previous: Separate submodules, Up: Submodules   [Contents]


9.3.3 Visibility rules

Any declarations in the parent module, including those in the parent module’s implementation section, are visible in the parent’s submodules, including indirect submodules (i.e. sub-submodules, etc.). Similarly, declarations in the interfaces of any modules imported using an ‘:- import_module’ or a ‘:- use_module’ in the parent module are visible in the parent’s submodules, including indirect submodules.

Declarations in a child module are not visible in the parent module, or in “sibling” modules (other children of the same parent), or in other unrelated modules unless the child is explicitly imported using an ‘:- import_module’ or ‘:- use_module’ declaration. It is an error to import a module without importing all of its parent modules.

Note that a submodule for which the ‘:- module’ or ‘:- include_module’ declaration occurs only in the implementation section of the parent module may only be imported or used by its parent module or by submodules of its parent module.

As mentioned previously, all ‘:- import_module’ and ‘:- use_module’ declarations must use fully qualified module names.