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-07 (09:20)
From: Francois Rouaix <Francois.Rouaix@i...>
Subject: Re: functors in batch compilation
> but does this mean one is forced to declare a functorized struct
> in a signature as well as in the implementation file?

You are never forced to write .mli files, but it's good practice, both
for documentation purposes and for better separate compilation performance.

>  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.  
When defining functors, there are usually two components in the implementation
file. One is the "module type" for the functor argument, the other is
the functor itself.

> 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.
Have you checked the library ? Several modules contain functors (e.g. Set
or Map).