From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA09751 for caml-redistribution; Fri, 19 Feb 1999 19:18:16 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA09662 for ; Fri, 19 Feb 1999 16:29:33 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id QAA21151; Fri, 19 Feb 1999 16:29:31 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA17278; Fri, 19 Feb 1999 16:29:30 +0100 (MET) Message-ID: <19990219162930.37090@pauillac.inria.fr> Date: Fri, 19 Feb 1999 16:29:30 +0100 From: Xavier Leroy To: Manuel Fahndrich , "CAML List (E-mail)" Subject: Re: Signature matching question? References: <25983782061AD111B0800000F86310FE1026CAFD@RED-MSG-42> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <25983782061AD111B0800000F86310FE1026CAFD@RED-MSG-42>; from Manuel Fahndrich on Thu, Feb 11, 1999 at 05:47:39PM -0800 Sender: weis > I've run into the following problem with signature matching. > > module type FOO = > sig > type bar > module A : sig val fresh : unit -> bar end > end > > module Foo : FOO = > struct > module A = > struct type t = {foo: int} let fresh () = {foo=1} end > type bar = A.t > end > > [... Signature mismatch ...] > Is this intended behavior, or a bug? I would assume that within a module, > delcarations are treated as an unordered set. It is a bug. The intent is, as you say, to perform signature matching independently of the order of module components. The typing rules currently implemented get it right when there are only type and value components, something is wrong with nested modules as in your example. Indeed, your example type-checks when rewritten as follows: > module Foo1 = > struct > module A = > struct type t = {foo: int} let fresh () = {foo=1} end > type bar = A.t > end > module Foo : FOO = Foo1 The naming of the structure allows the type-checker to get its type names right. It's not obvious how to change the signature matching rules, though, so I don't promise a quick fix. - Xavier Leroy