Modules A program written in Refal Plus consists of one or more modules. Each module comprises two components: the interface of the module and the implementation of the module. program module module interface module interface module implementation module implementation import implementation directive

The interface of a module contains the parts of the module that may be visible in other modules, whereas the implementation of the module contains the parts of the module that are invisible in other modules.

Each module MMMM occupies two files. Namely, the interface of the module is kept in the file MMMM.rfi, and the implementation in the file MMMM.rf.

ModuleInterface =
     { Declaration }.

ModuleImplementation =
     { Import } { ImplementationDirective }.

Import = "$use" { ModuleName } ";".

ImplementationDirective =
     Declaration |
     TraceDirective |
     FunctionDefinition.

The names declared in the interface of a module YYYY can be made visible in the implementation of a module XXXX by putting the directive $use YYYY into the implementation of the module XXXX in the following way:

// File XXXX.rfi // The interface of the module XXXX. ...... // File XXXX.rf $use ... YYYY ... ; // Henceforth, the names declared in YYYY.rfi // will be visible. ...... // File YYYY.rfi // The interface of the module YYYY. ...... // File YYYY.rf // The implementation of the module YYYY. ......

Some operating systems disregard the difference between small and captial letters in file names. For example, StdIO.rfi, StdIo.rfi, Stdio.rfi are regarded as equivalent. Thus it is reasonable to avoid the situation in which there are two modules in a program whose names differ only in the case of letters.