From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id E1238BB81 for ; Tue, 7 Dec 2004 20:26:08 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iB7JQ80C016399 for ; Tue, 7 Dec 2004 20:26:08 +0100 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 UAA08746 for ; Tue, 7 Dec 2004 20:26:08 +0100 (MET) Received: from postfix3-1.free.fr (postfix3-1.free.fr [213.228.0.44]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iB7JQ72v026583; Tue, 7 Dec 2004 20:26:08 +0100 Received: from localhost (gobelins-4-81-56-65-67.fbx.proxad.net [81.56.65.67]) by postfix3-1.free.fr (Postfix) with ESMTP id 9F2A41753DB; Tue, 7 Dec 2004 19:41:09 +0100 (CET) Received: from boris by localhost with local (Exim 3.36 #1 (Debian)) id 1CbkGr-0001dl-00; Tue, 07 Dec 2004 19:41:09 +0100 Date: Tue, 7 Dec 2004 19:41:09 +0100 From: Boris Yakobowski To: caml-list@inria.fr Subject: Re: [Caml-list] Type constraints Message-ID: <20041207184108.GA5854@elrond> Reply-To: Boris Yakobowski Mail-Followup-To: Boris Yakobowski , caml-list@inria.fr References: <20041206195527.GA32094@draco.skynet> <41B557D4.2000306@inria.fr> <076FEF06-4856-11D9-8195-000D9345235C@inria.fr> <41B5C4C8.9040701@ps.uni-sb.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux elrond 2.6.7 User-Agent: Mutt/1.5.6+20040907i Sender: Boris Yakobowski X-Miltered: at concorde with ID 41B603D0.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41B603CF.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; yakobowski:01 yakobowski:01 caml-list:01 damien:01 wrote:01 rossberg:01 wrote:01 struct:01 struct:01 sig:01 val:01 sig:01 val:01 restrictive:01 polymorphic:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Tue, Dec 07, 2004 at 06:44:36PM +0100, Damien Doligez wrote: > > On 7 Dec 2004, at 15:57, Andreas Rossberg wrote: > > >Is this really a counter-example? I don't see any problem with making > >it polymorphic - it evaluates to ref, and ref can happily be > >polymorphic. > > Yes, well I simplified it a bit too much. Try this instead: > > let module M = struct let v = ref [] end in M.v;; The question remains : why not generalize type variables which would be generalized at the end of a non local module? : # module M = struct let v = ref [] end;; module M : sig val v : '_a list ref end # module M = struct let v x = x end;; module M : sig val v : 'a -> 'a end # let module M = struct let v = ref [] end in M.v;; - : '_a list ref = {contents = []} # let module M = struct let v x = x end in M.v (* This seems overly restrictive *);; - : '_a -> '_a = Besides: # type t = {t : 'a. 'a -> 'a};; type t = { t : 'a. 'a -> 'a; } # let module M = struct let v x = x end in { t = M.v };; - : t = {t = } -- Boris