* typing difference (bug?) between 3.10.2 and 3.11(.1?)
@ 2009-06-07 13:28 Josh Berdine
0 siblings, 0 replies; only message in thread
From: Josh Berdine @ 2009-06-07 13:28 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-07 13:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-07 13:28 typing difference (bug?) between 3.10.2 and 3.11(.1?) Josh Berdine
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).