module ("M" Reference)
[This is prerelease documentation and is subject to change in future releases. Blank topics are included as placeholders.]
The module keyword is used to declare a scope. This module scope lets you create types, computed values, and extents. All other Microsoft code name “M” directives must appear inside a module.
Syntax
module ModuleName
{
import directives;
export directives;
other “M” declarations;
}
ModuleName is any valid “M” identifier.
“Other “M” declarations” does not include module declarations.
Discussion
A “M” source file is made up of one or more modules.
The module is a unit of scope. To allow other modules to refer to things inside a module, use the export directive. To refer to things exported by another module, use an import directive. Within a module, any import directives must appear before any export directives, and any import or export directive must appear before declarations.
Modules cannot be nested.
Example
The following is an example of a module that defines a contacts database.
module Contacts
{
export Person;
export People;
type Person
{
Name: Text;
}
People : Person*
{
{Name => "Terry Adams"},
{Name => "Jay Hamlin"},
{Name => "David Pelton"},
{Name => "Josh Barnhill"}
}
}
See Also
Concepts
Modules ("M" Programming Guide)
import ("M" Reference)
export ("M" Reference)