Definition module (source code)

= Definition module

A <definition module> declares the exported interface of a <Modula-2> module. It tells clients which names and <data types> they can use, while the <implementation module> supplies procedure bodies and private details. The boundary supports separate <compilation> and <programming abstraction>.

For example, a <stack> interface can declare an abstract <stack> type and push/pop operations without exposing whether storage uses an <array> or a <linked list>. Clients should preserve the declared contract rather than inspecting hidden representation. GNU Modula-2 conventionally stores a <definition module> in a `.def` <file> and parses it when compiling importing modules; it does not compile the <definition module> separately as executable code.<Compiler options in the GNU Modula-2 documentation>[§2.2, .def and .mod source-file handling]{ref}