The implementation is the private portion of a module. Implementation files have the name of the module with an ".m3" extension, and have the following format:
MODULE module-name [ EXPORTS interface { "," interface ... } ]; IMPORT imported-interfaces; Declarations; ... Declarations;
BEGIN ...Module start-up code... END module-name.
Generally, module-name is the same as the name of the interface being implemented, but if not, the EXPORTS clause can be used to specify the interfaces exported by this module.
Here is the implementation of the previous interface:
MODULE Thing; IMPORT IO; PROCEDURE Print(READONLY r: T) = BEGIN IO.Put (r.name & "\t"); IO.PutInt (r.size); IO.Put ("\n"); END Print; PROCEDURE Make(n: TEXT; s: INTEGER): T = BEGIN RETURN T{n, s}; END Make; END Thing.