module_decl Production

Definition

module_decl : declspec_list module identifier sig_list ;
            | declspec_list module identifier sig_list = exp ;

Purpose

A module_decl declares a module, or binds an existing one to a name. The only way to create a new module is with a call to a template, or with a module_def. In the case of an initialized definition, both names refer to the same module.

Semantics

The initializer expression must be a combination of only variable_exps, field_exps, and call_exps. It must refer to a module.

If there is an initializer, its type must implement a superset of the signatures given in sig_list. These must be explicitly given in the initializer's own sig_list.

Exactly one module_def may coexist with exactly one uninitialized module_decl of the same name, which states implementation of an equivalent or subset of the signatures in sig_list.