From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id TAA26834 for caml-redistribution; Fri, 14 Jun 1996 19:22:47 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id LAA16534 for ; Fri, 14 Jun 1996 11:22:40 +0200 Received: from cherub.hd.ibm.de (cherub.hd.ibm.de [192.101.197.10]) by concorde.inria.fr (8.7.1/8.7.1) with SMTP id LAA06098 for ; Fri, 14 Jun 1996 11:22:29 +0200 (MET DST) Received: from kaa.heidelbg.ibm.com by cherub.hd.ibm.de (AIX 3.2/UCB 5.64/4.03/chkV1.0) id AA23784; Fri, 14 Jun 1996 11:21:32 +0200 Received: from idse.heidelbg.ibm.com by kaa.heidelbg.ibm.com (AIX 3.2/UCB 5.64/4.03) id AA87102; Fri, 14 Jun 1996 11:21:06 +0200 Received: by idse.heidelbg.ibm.com (AIX 3.2/UCB 5.64/4.03) id AA32629; Fri, 14 Jun 1996 11:21:04 +0200 Message-Id: <9606140921.AA32629@idse.heidelbg.ibm.com> To: Bouzid Djamila Cc: caml-list@pauillac.inria.fr Subject: Re: Probleme d'interface In-Reply-To: (Your message of Thu, 13 Jun 96 18:45:33 O.) <199606131645.SAA17944@delsarte.loria.fr> Date: Fri, 14 Jun 96 11:21:04 +0100 From: Wolfgang Lux Sender: weis Bouzid Djamila writes: > > Hi! > > I have two CSL files : vendor.mli (the interface) and vendor.ml > > (* vendor.mli *) > module type VENDOR_INTEGER = > sig > val min : int * int -> int > end (* sig *) > > module type VENDOR = > sig > val print: string -> unit > module Integer : VENDOR_INTEGER > end (* sig *) > > > (*vendor.ml *) > open vendor > module V : VENDOR = > struct > let print = print_string > module Integer : VENDOR_INTEGER = > struct > let min ((x:int),(y:int)) = if x < y then x else y > end > end (* functor V *) > > when compiling these programs, I receive the following error message : > > finot ip 175 % cslc -i vendor.mli > module type VENDOR_INTEGER = sig val min : int * int -> int end > module type VENDOR = > sig val print : string -> unit module Integer : VENDOR_INTEGER end > finot ip 176 % cslc -i vendor.ml > module V : Vendor.VENDOR > The implementation vendor.ml does not match the interface vendor.cmi: > The field `VENDOR' is required but not provided > The field `VENDOR_INTEGER' is required but not provided > finot ip 177 % > > Please, could you tell me where's the problem ? > The problem simply is, that you have to define both modules types VENDOR_INTEGER and VENDOR in vendor.ml as well to compile. But actually this is not what you really want, as the local module V is not visible at all outside of vendor.ml! (And in contrary to your comment it is not a functor!) If you look into the Caml Special Light reference, you will see that the files vendor.mli and vendor.ml constitute themselves a module which is roughly equivalent to module Vendor : sig <> end = struct <> end So you wanted probably to write the following module interface vendor.mli: module type VENDOR_INTEGER = sig val min : int * int -> int end (* sig *) val print: string -> unit module Integer : VENDOR_INTEGER And your implementation vendor.ml then would look as follows: module type VENDOR_INTEGER = sig val min : int * int -> int end let print = print_string module Integer : VENDOR_INTEGER = struct let min ((x:int),(y:int)) = if x < y then x else y end Hope this helps, 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