8.4 Functor Programs

so far, all our functors were created interactively. The better way to develop software with Mozart is to write one functor per file. In this fashion, each file describes one module in your application. We will call a file that contains the code of a functor a ``functor program''. The syntax of a functor program omits the variable following the functor keyword. A functor program for our greeting module is:

functor 
import System
export Greet
define 
   proc {Greet}
      {System.showInfo "hello world!"}
   end 
end

Let us write it to a file called Greet.oz. The functor value corresponding to this program is obtained by compiling the file. In general compilation of Oz code is the job of the Mozart compiler ozc. However, we will instead promote a simpler and more general tool called ozmake. It is invoked from the command line:

ozmake Greet.ozf

automagically ``builds'' Greet.ozf by compiling Greet.oz: Greet.oz contains a functor program and after compilation Greet.ozf contains the corresponding persistent functor value.

8.4.1 ozmake

You will have to download and install ozmake on your machine. While ozmake is available in source form from The MOGUL Archive, for your convenience prebuilt executables are also provided:

Also, it might help to have a look at the ozmake documentation page.


Denys Duchier, Claire Gardent and Joachim Niehren
Version 1.3.99 (20050412)