Re: Piece composition of signatures (& problems derived from them too!)

Wolfgang Lux (lux@heidelbg.ibm.com)
Tue, 17 Dec 96 18:49:06 +0100

Message-Id: <9612171749.AA39644@idse.heidelbg.ibm.com>
To: caml-list@inria.fr
Subject: Re: Piece composition of signatures (& problems derived from them too!)
In-Reply-To: (Your message of Tue, 17 Dec 96 12:58:02 PST.)
<32B7095A.99A@ing.uc3m.es>
Date: Tue, 17 Dec 96 18:49:06 +0100
From: Wolfgang Lux <lux@heidelbg.ibm.com>

> # module type MIXED =
> sig
> include ORDER
> include TOTAL with type t = t (* THIS IS THE PROBLEM *)
> end;;
>
> module type MIXED =
> sig
> type t
> val <= : t -> t -> bool
> type t = t
> val compare : t -> t -> int
> end
>
> Characters 31-91:
> Signature mismatch:
> Modules do not match:
> sig
> type t = int
> val <= : 'a -> 'a -> bool
> val compare : int -> int -> int
> end
> is not included in
> MIXED
> Type declarations do not match: type t = int is not included in type t =
> t
>
> The problem seems to be that the second "t" hides the first or the type
> equation t = int vanishes.

I suspect neither of your assumptions is correct. The problem is that
your module type MIXED includes two(!) type variables named t (look
carefully at the output of the compiler) while your implementation
only provides one. Probably the compiler should already flag your
definition of MIXED as an error because the name t is defined twice in
the environment. (BTW try to enter the expande of the compiler into the
compiler and it will happily barf on you :-)

Regards
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