The Poly/ML Make System


PolyML.make is a function to help maintain consistency of programs made up of several modules. PolyML.make works on modules (files containing functors, structures and signatures) and tries to ensure that a module is consistent with respect to the modules it uses.

The Poly/ML compiler has two modes of operation: normal mode and 'make' mode. When the compiler is operating in 'make' mode and it encounters the name of a functor, structure or signature, it determines whether it is necessary to remake that object from its source code.

The make system assumes that source code for functors, structures and signatures is kept in files whose names resemble those of the objects. The variable PolyML.suffixes contains the list of filename suffixes recognised by the make system, in the order that the system tries them. The default list is ["", ".ML", ".sml"].

For example, if the object is called 'name', the system first tries to find a file called name, then tries name.ML, and finally tries name.sml if neither of the other files exists. Alternatively, 'name' may be a directory containing a file called 'ml_bind.ML'. If the make system fails to find any matching file then it assumes the object is pervasive and will use the existing version of it.


For example, suppose we have a system in which the structure Sort is created by applying the functor SORT to the structures Combinator and List and that Combinator is itself created by applying the functor COMBINATOR to the structure List.

To use the make system, we would create a directory Sort with subdirectory Sort/Combinator and the following files:

File Contents
Sort/List.ML Code for structure List
Sort/Combinator/COMBINATOR.ML Code for functor COMBINATOR
Sort/Combinator/ml_bind.ML Code to create Combinator
Sort/SORT.ML Code for functor SORT
Sort/ml_bind.ML Code to create Sort

These files should have the following format:


structure List =
struct (* body of List *) end;


signature LSIG =
sig (* body of LSIG, as used by COMBINATOR *) end;

functor COMBINATOR(structure L : LSIG) =
struct (* body of COMBINATOR *) end;


structure Combinator =
COMBINATOR(structure L = List);


signature CSIG =
sig (* body of CSIG *) end;

signature LSIG =
sig (* body of LSIG, as used by SORT *) end;

functor SORT (structure C : CSIG structure L : LSIG) =
(* body of SORT *)