Go to the first, previous, next, last section, table of contents.

IMPORT Statement

IMPORT <module-name> [ AS <alias> ] { "," ... } ";"
  or
FROM <module-name> IMPORT <decl-name> { "," <decl-name>...} ";"

The IMPORT statement allows a module to see declarations such as procedures and types that appear in another module's interface. IMPORT statements must appear after the MODULE or INTERFACE statement and before any declarations.

When using declarations imported from another module, the nonlocal declaration name must be qualified with the name of the module it was imported from unless the second form of the IMPORT statement is used. For example:

INTERFACE Box;

CONST Size = 30;

END Box;

(* Client Module *)
MODULE Toys;

IMPORT Box;

VAR boxSize := Box.Size;  (* Nonlocal declaration Size qualified
                             by module name Box *)
END Toys.

(* Another Client Module *)
MODULE Toys2;

FROM Box IMPORT Size;

VAR boxSize := Size; (* Nonlocal reference Size not qualified *)

END Toys2;


Go to the first, previous, next, last section, table of contents.