caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ohad Rodeh <orodeh@cs.huji.ac.il>
To: Caml List <caml-list@inria.fr>
Subject: Ref polymorphism restriction
Date: Mon, 25 Dec 2000 09:34:13 +0200 (IST)	[thread overview]
Message-ID: <Pine.LNX.4.10.10012250930420.7348-100000@zigzag.cs.huji.ac.il> (raw)

List,
  The following program does not compile, with a 
rather strange error message. 

module type SIG = 
  sig
    val l : '_a list ref
    val f : '_a -> unit
  end

module M : SIG = 
  struct
    let l = ref [] 
      
    let f a = l:= a::!l
  end


Modules do not match:
  sig val l : '_a list ref val f : '_a -> unit end
is not included in
  SIG
Values do not match:
  val l : '_a list ref
is not included in
  val l : 'a list ref

Note that the signature for list l IS '_a list ref. 

I suppose this is due to the restriction on polymorphic references. 
Is the OCaml restriction such that references may only be local to
a single module? Is there a different restriction? 

	Ohad.

----------------------------------------------------------
orodeh@cs.huji.ac.il
www.cs.huji.ac.il/~orodeh





             reply	other threads:[~2000-12-25 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-12-25  7:34 Ohad Rodeh [this message]
2000-12-25 22:09 ` Pierre Weis

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=Pine.LNX.4.10.10012250930420.7348-100000@zigzag.cs.huji.ac.il \
    --to=orodeh@cs.huji.ac.il \
    --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;
as well as URLs for NNTP newsgroup(s).