Yet another question about the module system

Jocelyn Serot (jserot@epcc.ed.ac.uk)
Fri, 18 Oct 1996 09:41:36 +0100 (BST)

Message-Id: <17349.199610180841@tufa.epcc.ed.ac.uk>
Subject: Yet another question about the module system
To: caml-list@margaux.inria.fr
Date: Fri, 18 Oct 1996 09:41:36 +0100 (BST)
From: Jocelyn Serot <jserot@epcc.ed.ac.uk>

Hello,

In a previous post i was asking a few questions about the relations between
the module system and separate compilation. Thanks to the clever answers of
a few people, i thought i have understood the whole stuff. Until i encounter
the following pb:

Suppose i have 2 files:

A first one, specifying an interface for an abstract type Bar:

****** bar.mli **********
type t
val x :t
*************************

A second one, specifying a second abstract type built upon the first one
using functor application

****** foo.mli **********
module type FOO = sig type t val y : t end
module Make(B:Bar) : (FOO with type t = Bar.t)
*************************

Trying to compile this separately:

> ocamlc -c bar.mli
> ocamlc -c foo.mli

produces the following error message:
> File "foo.mli", line 3, characters 14-17: Unbound module type Bar

BUT, if write foo.mli like that

****** foo.mli **********
module type FOO = sig type t val y : t end
val y : Bar.t
*************************

Everythings compiles ok.
So, it seems that the Bar interface is known when compiling Foo (i guess this
goes trough the bar.cmi file).
Why cannot it be used as a functor argument then ?

Jocelyn Serot

Es-mail: jserot@epcc.ed.ac.uk (->Nov 29/96) ...............................
S-mail: LASMEA - URA 1793 CNRS, Universite Blaise Pascal, 63177 Aubiere cedex
Tel: (33) 73.40.73.30 - Fax: (33) 73.40.72.62 ...............................
.... http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/Welcome.html