In module systems, there are two philosophies regarding the relation between logical and physical names of modules. Some languages make the physical location independent of the logical identifier. For example, in ML dialects, the location of a file is irrelevant and only the names of the modules therein are logically meaningful.
Other languages use the phyiscal location to form qualified logical identifiers. For example, Python uses directories and files to form qualified identifiers for toplevel declarations.
A kind of mixture is employed in Java, where files begin with a package declaration defining the logical namespace, but are also recommended to be placed in a corresponding directory structure.
MMT adopts a flexible namespace mechanism that can be customized to obtain either behavior.
Every source file corresponds to a document, whose logical identifier is formed from the
narration-base of the archive and the physical path of the file in the archive. .mmt-Files may have a namespace declaration, which defines the logical base identifier of the modules declared in the sequel. The surface syntax is
(delimited by the module delimiter)
A namespace-URI is an instance of the class
The given namespace may be an absolute or a relative URI, and the latter are interpreted relative to the current namespace. At the beginning of a file, the current namespace is the corresponding document identifier.
narration-base. Thus, moving or copying an archive as a whole does not affect logical identifiers.
If all files begin by declaring
. as the namespace, the behavior is like in the previous example except that only folder names count and file names are ignored.
This is particularly useful in connection with the convention that every file contains exactly one module, whose name is the same as (or systematically related to) the file name.
As a special case of the previous example, if all files begin by declaring the same absolute URI as the namespace, all modules reside in the same logical namespace.