Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Patrick M Doane <patrick@watson.org>
To: caml-list@inria.fr
Subject: [Caml-list] Module typing
Date: Fri, 14 Dec 2001 11:41:45 -0500 (EST)	[thread overview]
Message-ID: <20011214113557.I86802-100000@fledge.watson.org> (raw)

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


                 reply	other threads:[~2001-12-14 16:41 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=20011214113557.I86802-100000@fledge.watson.org \
    --to=patrick@watson.org \
    --cc=caml-list@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