caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Josh Berdine <jjb@microsoft.com>
To: "caml-list@yquem.inria.fr" <caml-list@yquem.inria.fr>
Subject: typing difference (bug?) between 3.10.2 and 3.11(.1?)
Date: Sun, 7 Jun 2009 14:28:16 +0100	[thread overview]
Message-ID: <857DD0FDAC042B4485F9F5F4EA6751042D82FC23A5@EA-EXMSG-C332.europe.corp.microsoft.com> (raw)

Hi,

I'm observing a difference in typing-checking of private types between 3.10.2 and 3.11.1+rc1 (I haven't checked 3.11.0).

Consider the following code:

    module M : sig
      type t = private T of int
      val mk : int -> t
    end = struct
      type t = T of int
      let mk x = T(x)
    end

    module M' = M

    let x = M'.mk 42

    let y = M'.T(42)

With 3.10.2, the let binding for y fails to type-check:

            Objective Caml version 3.10.2
    [snip]
    # let y = M'.T(42);;
    Characters 8-16:
      let y = M'.T(42);;
              ^^^^^^^^
    Cannot create values of the private type M'.t

With 3.11.1+rc1, however, it type-checks:

            Objective Caml version 3.11.1+rc1
    [snip]
    # let y = M'.T(42);;
    val y : M'.t = M'.T 42
    #

Am I misunderstanding the type system, or is this not intended?

If I change the code to declare t private in the struct, or if I do not use the alias for M, type-checking fails as expected.

Cheers,  Josh


                 reply	other threads:[~2009-06-07 13:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=857DD0FDAC042B4485F9F5F4EA6751042D82FC23A5@EA-EXMSG-C332.europe.corp.microsoft.com \
    --to=jjb@microsoft.com \
    --cc=caml-list@yquem.inria.fr \
    /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).