Re: CSL modules

Wolfgang Lux (lux@heidelbg.ibm.com)
Tue, 05 Mar 96 10:03:33 +0100

Message-Id: <9603050903.AA36425@idse.heidelbg.ibm.com>
To: Xavier Leroy <Xavier.Leroy@inria.fr>
Subject: Re: CSL modules
In-Reply-To: (Your message of Mon, 04 Mar 96 15:05:49 N.)
<199603041405.PAA26261@pauillac.inria.fr>
Date: Tue, 05 Mar 96 10:03:33 +0100
From: Wolfgang Lux <lux@heidelbg.ibm.com>

> This is easily done using a signature constraint to specify exactly
> how much of C should remain visible:
>
> module type SIGA =
> sig
> type ta = A | B of int
> val xa : ta
> end
> module type SIGB =
> sig
> type tb = C | D of string
> val xb : tb
> end
>

[ alternate (and better) definition of SIGC and F deleted]

> module type SIGC =
> sig
> type ta = A.ta (* concrete *)
> type tb (* abstract *)
> val xa : ta
> val xb : tb
> end
> module F(A: SIGA)(B: SIGB) =
> (struct
> type ta = A.ta
> type tb = B.tb
> let xa = A.xa
> let xb = B.xb
> end : SIGC)
> module C = F(A)(B)
>

Being curious I tried this and got an error from CSL 1.14, which I
really don't understand. After defining SIGA and SIGB and the
following two sample modules

module A : SIGA =
struct
type ta = A | B of int
let xa = B 4
end
module B : SIGB =
struct
type tb = C | D of string
let xb = D "hello"
end

I can define SIGC, but when I enter the definition of F, CSL returns
the following error:

Signature mismatch:
Modules do not match:
sig type ta = A.ta type tb = B.tb val xa : A.ta val xb : B.tb end
is not included in
SIGC
Type declarations do not match:
type ta = A.ta
is not included in
type ta = A.ta

Any clues?

Wolfgang

----
Wolfgang Lux
WZH Heidelberg, IBM Germany Internet: lux@heidelbg.ibm.com
+49-6221-59-4546 VNET: LUX at HEIDELBG
+49-6221-59-3500 (fax) EARN: LUX at DHDIBMIP