modulename [ ( parameters ) ] := MODULE [ ( inherit ) ] [, VIRTUAL ] [, LIBRARY(interface) ] [, FORWARD ]
members;
END;
The MODULE structure is a container that allows you to group related definitions. The parameters passed to the MODULE are shared by all the related members definitions. This is similar to the FUNCTION structure except that there is no RETURN.
The scoping rules for the members are the same as those previously described in the Definition Visibility discussion:
Local definitions are visible only through the next EXPORT or SHARED definition (including members of the nested MODULE structure, if the next EXPORT or SHARED definition is a MODULE).
SHARED definitions are visible to all subsequent definitions in the structure (including members of any nested MODULE structures) but not outside of it.
EXPORT definitions are visible within the MODULE structure (including members of any subsequent nested MODULE structures) and outside of it .
Any EXPORT members may be referenced using an additional level of standard object.property syntax. For example, assuming the EXPORT MyModuleStructure MODULE structure is contained in an ECL Repository module named MyModule and that it contains an EXPORT member named MyDefinition, you would reference that definition as MyModule.MyModuleStructure.MyDefinition:
MyMod := MODULE
SHARED x := 88;
y := 42;
EXPORT InMod := MODULE //nested MODULE
EXPORT Val1 := x + 10;
EXPORT Val2 := y + 10;
END;
END;
OUTPUT(MyMod.InMod.Val1);
OUTPUT(MyMod.InMod.Val2);