Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
functors in batch compilation
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-05-06 (07:38)
From: Lyn A Headley <laheadle@m...>
Subject: functors in batch compilation

While I think the Ocaml manual gives a good general tutorial on the
subject of the Module system, I am still confused about the _details_
of functorizing a module in a file.  

The docs provide this hint:

Notice that only top-level structures can be mapped to
separately-compiled files, but not functors nor module types. However,
all module-class objects can appear as components of a structure, so
the solution is to put the functor or module type inside a structure,
which can then be mapped to a file.

but does this mean one is forced to declare a functorized struct
in a signature as well as in the implementation file?  It would
seem to make more sense for the compiler to realize that it was
dealing with an implementation of a single module described in the
implementation file and just allow the signature to describe the
values of the (functorized) module that it wants to export.  This
would avoid needing two names per module, one for the file and another
for the module.  

I realize I might not be making sense but basically I don't understand
how to compile a functorized module into a file, and I wanted to prove
that I at least thought about it, thereby lessening the impression
that I am a punk kid who don't know nothin.