module ( shared as name
          | interface shared as name
          | implements name)?


An OmniMark module file begins with a module declaration. A file may contain only a single module.

A module is a component of OmniMark code that defines exactly what it allows access to (exports) in the code outside the module. A module may export record definitions, global variables and constants, or functions.

The keyword shared indicates a shared module. The name in a shared module declaration is used by OmniMark to determine whether the module has already been imported or not. Programmers should use different names for different modules. The name must be either a valid OmniMark name or a quoted string. You should try to use names that are unlikely to be used by third party modules. Prefacing the name with your company's URL is a useful way of increasing the chance of uniqueness.

     module shared as com.stilo.omnimark.omvfs

A module can also be declared to be an interface or implementation module. Normally a module specifies the interface and the implementation in a single file, but sometimes it is useful to separate the interface and the implementation.

An interface module specifies exactly what the implementation module is permitted to export. The interface contains only declarations, but no executable code (like function bodies or rules) or initial values (for variables or constants). The implementation module defines all of the functions, rules, and any variables which have initial values. This separation allows many implementation modules to be written to the same interface, promoting reusability.

To declare a module interface:

  module interface shared as <module identifier>

To declare a module implementation:

  module implements <module identifier>

To import a module interface:

  import <module-file-name> [unprefixed | prefixed by <prefix>]

To import a module implementation:

  import <module-file-name> [unprefixed | prefixed by <prefix>]

The keywords interface and implements following the keyword module indicate the type of the module. A module which is split between interface and implementation is always a shared module.

The prefix declaration used to import the interface must match the prefix declared for the interface.

You are not required to declare the interface and the implementation separately. You can still declare a module in a single file, as in earlier versions of OmniMark.