* [Caml-list] strange behaviour with variants and "cannot be generalized"
@ 2003-09-09 7:15 Beck01, Wolfgang
2003-09-09 12:11 ` Jacques Garrigue
0 siblings, 1 reply; 2+ messages in thread
From: Beck01, Wolfgang @ 2003-09-09 7:15 UTC (permalink / raw)
To: caml-list
I have three files
vtop.ml --------------------------
type 'a t = {
t_c : 'a;
}
v1.ml ----------------------------
open Vtop
type t = {
v1_x : int array;
}
let init = `V1 { v1_x = [| 0 |] }
v2.ml ----------------------------
open Vtop
type t= {
v2_x : int;
}
let init = `V2 { v2_x = 0 }
---------------------------------
compilation fails with "The type of this expression _[> `V1 of t ] Vtop.t,
contains type variables that cannot be generalized"
However, if I change the type of v1_x to a string or some large struct,
it compiles without warning and works. The error seems only to occur
with arrays. I am using version 3.06.
Is there an explanation for this behaviour?
Wolfgang Beck
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-09-09 12:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-09 7:15 [Caml-list] strange behaviour with variants and "cannot be generalized" Beck01, Wolfgang
2003-09-09 12:11 ` Jacques Garrigue
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).