Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Module typing
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Patrick M Doane <patrick@w...>
Subject: [Caml-list] Module typing
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