From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA29933 for caml-red; Mon, 25 Dec 2000 23:00:45 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA32554 for ; Mon, 25 Dec 2000 08:39:58 +0100 (MET) Received: from cs.huji.ac.il (cs.huji.ac.il [132.65.16.10]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eBP7dv908374 for ; Mon, 25 Dec 2000 08:39:57 +0100 (MET) Received: from zigzag.cs.huji.ac.il ([132.65.208.204] ident=root) by cs.huji.ac.il with esmtp (Exim 3.20 #1) id 14ASEe-0000FY-00 for caml-list@inria.fr; Mon, 25 Dec 2000 09:39:56 +0200 Received: from localhost (orodeh@localhost) by zigzag.cs.huji.ac.il (8.9.3/1.1c) with ESMTP id JAA08399 for ; Mon, 25 Dec 2000 09:34:13 +0200 X-Authentication-Warning: zigzag.cs.huji.ac.il: orodeh owned process doing -bs Date: Mon, 25 Dec 2000 09:34:13 +0200 (IST) From: Ohad Rodeh To: Caml List Subject: Ref polymorphism restriction Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis@pauillac.inria.fr 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