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 D1CBBBB81 for ; Thu, 9 Dec 2004 01:56:08 +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 iB90u88k022897 for ; Thu, 9 Dec 2004 01:56: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 BAA02938 for ; Thu, 9 Dec 2004 01:56:08 +0100 (MET) Received: from mail.kaba.or.jp (cascade.kaba.or.jp [202.249.19.34]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iB90u6kY022884 for ; Thu, 9 Dec 2004 01:56:07 +0100 Received: from localhost (klingon.kaba.or.jp [202.249.19.14]) by mail.kaba.or.jp (Postfix) with ESMTP id 89E2E49A8C; Thu, 9 Dec 2004 09:56:02 +0900 (JST) Date: Thu, 09 Dec 2004 09:56:02 +0900 (JST) Message-Id: <20041209.095602.74680404.keiko@kaba.or.jp> To: garrigue@math.nagoya-u.ac.jp Cc: caml-list@inria.fr Subject: Re: [Caml-list] Type constraints From: nakata keiko In-Reply-To: <8002B033-4906-11D9-8195-000D9345235C@inria.fr> References: <41B62407.4020102@inria.fr> <20041208.123051.74739504.keiko@kaba.or.jp> <8002B033-4906-11D9-8195-000D9345235C@inria.fr> X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 41B7A2A8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41B7A2A6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 kaba:01 damien:01 wrote:01 wrote:01 struct:01 struct:01 typechecker:01 polymorphic:01 polymorphic:01 doligez:01 expression:01 jacques:01 constraint:01 constraint: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: > On 8 Dec 2004, at 04:30, nakata keiko wrote: > > > This does not answer to me why this works, > > > > #type t = { t : 'a. 'a -> 'a} > > > > #let v = let module M = struct let t x = x end in {t = M.t} in (v.t 5, > > v.t true) > > You'll have to ask Jacques about this. He's the one who added > polymorphic > methods and polymorphic record labels to the language, and I'm not sure > I understand all the implications. I have the impression that if the above code is type checked, then, something like the following code could be type checked. What is the differences? > > However, if I can write something like > > > > #let v : 'a. 'a -> 'a = let module M = struct let t x = x end in M.t > > in (v 5, v true) > > > > then, it would be type checked ? > > I doubt it. For the moment, a type constraint can only specialize the > type of an expression. You're asking for a generalization constraint. > I have no idea whether that can be implemented, but I think it would > require some big changes to the typechecker. Regards, Keiko.