From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id DB9BCBB81 for ; Wed, 8 Dec 2004 02:03:19 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iB813JCP028599 for ; Wed, 8 Dec 2004 02:03:19 +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 CAA17972 for ; Wed, 8 Dec 2004 02:03:19 +0100 (MET) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iB813IqZ028590; Wed, 8 Dec 2004 02:03:18 +0100 Received: from [192.168.0.1] (rkeller-6-82-229-183-156.fbx.proxad.net [82.229.183.156]) by postfix4-1.free.fr (Postfix) with ESMTP id 65506217CCA; Tue, 7 Dec 2004 22:44:04 +0100 (CET) Message-ID: <41B62407.4020102@inria.fr> Date: Tue, 07 Dec 2004 22:43:35 +0100 From: Alain Frisch User-Agent: Mozilla Thunderbird 0.8 (X11/20040926) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Damien Doligez Cc: caml users Subject: Re: [Caml-list] Type constraints References: <20041206195527.GA32094@draco.skynet> <41B557D4.2000306@inria.fr> <076FEF06-4856-11D9-8195-000D9345235C@inria.fr> <41B5C4C8.9040701@ps.uni-sb.de> <41B5F1B2.3000503@inria.fr> <9296F5C2-4893-11D9-8195-000D9345235C@inria.fr> In-Reply-To: <9296F5C2-4893-11D9-8195-000D9345235C@inria.fr> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41B652D7.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41B652D6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; frisch:01 frisch:01 caml-list:01 damien:01 wrote:01 struct:01 struct:01 sig:01 val:01 sig:01 val:01 polymorphic:01 doligez:01 modules:01 constraints: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: Damien Doligez wrote: > So the answer to your original question is: the type is not generalized > because in some cases the let-module construct is not safely polymorphic. Ah ok, this explains that: # let module M = struct end in fun x -> x;; - : '_a -> '_a = Still, I'm not sure to understand the bottomline. Consider: # module M = struct let v = ref [] end;; module M : sig val v : '_a list ref end # M.v;; - : '_a list ref = {contents = []} Here M.v is not generalized either. But here it is: # module M = struct let v x = x end;; module M : sig val v : 'a -> 'a end # M.v;; - : 'a -> 'a = So I don't understand why the same cannot apply to local modules. If the let-module-in were declared "safe" for the value restriction, shouldn't let module M = struct let v = ref [] end in M.v yield a non-generalized type for the same reason as for the non-local case (and not because of the value restriction) ? -- Alain