From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id E2A077ED26 for ; Thu, 7 Jun 2012 21:54:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicCABEG0U/RVdI2imdsb2JhbABFhVCuWAgiAQEBCgkNBxIGI4IYAQEBBBICDx0BGx0BAwwGAwILDQICJgICIQEBEQEFARwGEyKHWgEDC5pmCQOLUlCCcIR7ChknDVeIcQEFDIEXiRpghG6BEgOVHYESiWyDHz6EGw X-IronPort-AV: E=Sophos;i="4.75,732,1330902000"; d="scan'208";a="146955584" Received: from mail-pz0-f54.google.com ([209.85.210.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-MD5; 07 Jun 2012 21:54:08 +0200 Received: by dadv36 with SMTP id v36so1762263dad.27 for ; Thu, 07 Jun 2012 12:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=7CcUP5NSRujXH7xf39D+VjOIvXbtiyYwV9rT4idCiI4=; b=X3EEZGpvp2kGr8Kw6HGBw5Bvwzf9xwT0GF15t9UsmpSHDkVie2CZ1DKNkYPq7y7A5y hXdROhb5ctqYleLQcvo8ZI1lLADHlrt6V0ZeFPlqd5mBmGqpmWAmbNStXf0sTnXwDOvz IvpH+dQcG/t4IgSYiwoO46ow5tk0FGv/0zu1RAYkEX6W1dilIJop8vyf4IOHbTDTwIsf 0QUW2n9Zu9uEA/oChYcEGvQzXZL0KeFGIuuFruYFSipkhDbKV7q0xUwA5GxImelsGRMR S7By7PvMSyX+hRdgAifXTZLC074Gmyipu/8Uvjw1wybf4m7DEGQuNxJUUf9QF2PxPnPo LsNA== Received: by 10.68.136.106 with SMTP id pz10mr11670657pbb.143.1339098847199; Thu, 07 Jun 2012 12:54:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.55.36 with HTTP; Thu, 7 Jun 2012 12:53:26 -0700 (PDT) In-Reply-To: References: From: =?UTF-8?Q?Milan_Stanojevi=C4=87?= Date: Thu, 7 Jun 2012 15:53:26 -0400 Message-ID: To: Markus Mottl Cc: Caml List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] strange error with packed modules and module type of If I just do ocamlopt.opt -for-pack G -c foo.mli foo.ml ocamlopt.opt -pack -o g.cmx foo.cmx that is, forget all the fancyness with std and specifying interface for G, the resulting G module has the type sig module Foo : sig type t =3D G.Foo.t val x : t end end So somehow the resulting interface of G is defined in terms of itself?! Should I just file this problem on ocaml mantis? p.s the only way I was able to get interface for G is to make a helper program that uses G with a wrong signature and get the compiler to give me the type in the error message. Is there a better way? main:ml module F : sig type t end =3D G let () =3D () $ ocamlopt.opt g.cmx main.ml File "main.ml", line 1, characters 28-29: Error: Signature mismatch: Modules do not match: sig module Foo : sig type t =3D G.Foo.t val x : t end end is not included in sig type t end The field `t' is required but not provided On Tue, May 29, 2012 at 10:30 PM, Markus Mottl wro= te: > On Tue, May 29, 2012 at 8:25 PM, Milan Stanojevi=C4=87 wrote: >> g.mli: >> module Std : sig include module type of Std end > > Btw., this is equivalent and slightly shorter: > > =C2=A0module Std : module type of Std > >> and compile similarly like before >> ocamlopt.opt -for-pack G -c foo.mli foo.ml >> ocamlopt.opt -for-pack G -c foo.cmx std.ml >> ocamlopt.opt -c g.mli >> ocamlopt.opt -pack -o g.cmx foo.cmx std.cmx >> >> But now I get this helpful error message > [snip] >> Does anyone know what is going on here? > > This seemingly identical construction compiles: > > g.mli: > module Std : sig module Foo : module type of Foo end > > I guess this also points to what is going wrong. =C2=A0If I understand th= is > correctly, the workaround basically says: "Std contains a submodule > Foo which just happens to have the same signature as the module > implemented by foo.ml". =C2=A0But the broken version says: "Std contains a > submodule Foo which is equivalent to the module implemented by > foo.ml". =C2=A0This equivalence is somehow lost with packing, hence the > unhelpful error message. =C2=A0Not sure, but I guess this can be fixed in > the compiler? > > Regards, > Markus > > -- > Markus Mottl=C2=A0 =C2=A0 =C2=A0 =C2=A0 http://www.ocaml.info=C2=A0 =C2= =A0 =C2=A0 =C2=A0 markus.mottl@gmail.com