Modules
Every file is a module. Declarations are private unless marked pub.
import "path/file.resid"; // all pub namesimport "path/file.resid" (name1, name2); // selected namesimport "path/file.resid" as M; // qualified: M.nameimport "path/file.resid" @requires(caps); // attenuatedNamespaces
Section titled “Namespaces”Each module has its own names. When two imported modules export the same name:
import "a.resid" as a;qualifies it:a.f(),a.Node;- a module’s own declaration wins over imported ones;
- an unqualified use that could mean either import is an error at that use
(
E0223). A local binding of the same name is not a use.
A displayed type or variant keeps its plain name.
Resolution
Section titled “Resolution”- The path relative to the importing file.
- A dependency listed in the project’s dependency map (
resid-manifest). - The standard library directory (
$RESID_HOME/../../lib, orlib/under the current directory).
A module that cannot be found is an error (E0221). Each module is
compiled once, whichever file imports it first.
Attenuation
Section titled “Attenuation”An attenuated import compiles the module, and everything it imports,
inside sandbox (caps): it can use at most those capabilities. A module
already imported without attenuation cannot be attenuated afterwards
(E0216); import it attenuated first. A manifest dependency is compiled
inside the capability ceiling its consumer’s manifest lists.
