[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.3 Structure mode

By default, Mosmake assumes that the units defined in the `Dependencies' file are to be compiled in Moscow ML's "toplevel" mode. That allows you to use the full SML modules language, and decouples structure names from file names (which is a Good Thing even though it will be easier to navigate your code if you maintain some kind of informal relation between structure and file names).

The main advantage of the older "structure" mode is that mosmlc can find the unit implementing a given structure from the file name; thus once you mention an unknown structure in SML source, mosmlc will automatically look for a structure-mode unit that implements it. By contrast, when you use toplevel-mode units, they must be enumerated explicitly on the mosmlc command line. But Mosmake takes care of that for you, so there's little reason why you'd want to create a structure-mode unit for a Mosmake-managed project.

However, you may want to reuse an existing unit that is written to be compiled in structure mode. The syntax and semantics of source files differ subtly between the two modes, so unles the existing unit comes without a `.sig' file and includes its own structure heading, it cannot be compiled in toplevel mode.

Mosmake allows you to override the default mode of toplevel on a unit-by-unit basis, by adding the flag %STRUCTURE among the depended-on units on the `Dependencies' line that declares the unit.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Henning Makholm on November, 19 2002 using texi2html