caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: "Milan Stanojević" <milanst@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] strange error with packed modules and module type of
Date: Tue, 29 May 2012 22:30:15 -0400	[thread overview]
Message-ID: <CAP_800qvf6r3XcSvEjYwnA=zreW2W1WeyYLRUKuGmp8ehfZOZA@mail.gmail.com> (raw)
In-Reply-To: <CAKR7PS_i+CzFB83asVn8=+x1iTD1R=aQjSFW3aUKDJd01+3yXQ@mail.gmail.com>

On Tue, May 29, 2012 at 8:25 PM, Milan Stanojević <milanst@gmail.com> wrote:
> g.mli:
> module Std : sig include module type of Std end

Btw., this is equivalent and slightly shorter:

  module 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.  If I understand this
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".  But the broken version says: "Std contains a
submodule Foo which is equivalent to the module implemented by
foo.ml".  This equivalence is somehow lost with packing, hence the
unhelpful error message.  Not sure, but I guess this can be fixed in
the compiler?

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com

  reply	other threads:[~2012-05-30  2:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30  0:25 Milan Stanojević
2012-05-30  2:30 ` Markus Mottl [this message]
2012-06-07 19:53   ` Milan Stanojević
2012-06-07 23:37     ` Jacques Garrigue
2012-06-08 20:36       ` Milan Stanojević

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP_800qvf6r3XcSvEjYwnA=zreW2W1WeyYLRUKuGmp8ehfZOZA@mail.gmail.com' \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=milanst@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).