* [Caml-list] Module typing
@ 2001-12-14 16:41 Patrick M Doane
0 siblings, 0 replies; only message in thread
From: Patrick M Doane @ 2001-12-14 16:41 UTC (permalink / raw)
To: caml-list
I have a question regarding the effect of module interfaces on the typing
of a module.
When a value contains type variables that cannot be generalized, one can
restrict the type in the interface to be monomorphic.
(* FAILS - type variables that cannot be generalized *)
module M1 = (
struct let tbl = Hashtbl.create 31 end
)
(* WORKS! *)
module M2 = (
struct let tbl = Hashtbl.create 31 end :
sig val tbl : (unit,unit) Hashtbl.t end
)
I'm curious to know why this idea does not extend to work for unbound type
variables in objects:
(* FAILS - unbound type variables *)
module O1 = (
struct class c = object method f x = x end end
)
(* ALSO FAILS - unbound type variables *)
module O2 = (
struct class c = object method f x = x end end :
sig class c : object method f : unit -> unit end end
)
Any possibilities of this changing in the future?
Thanks for any comments,
Patrick
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-12-14 16:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-14 16:41 [Caml-list] Module typing Patrick M Doane
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox