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 3352CBCAE for ; Thu, 30 Jun 2005 21:37:22 +0200 (CEST) Received: from smtp05.web.de (smtp05.web.de [217.72.192.209]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5UJbLIF002031 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 30 Jun 2005 21:37:22 +0200 Received: from [84.165.172.41] (helo=wiko) by smtp05.web.de with smtp (WEB.DE 4.105 #297) id 1Do4qf-0004Xs-00 for caml-list@yquem.inria.fr; Thu, 30 Jun 2005 21:37:21 +0200 Message-ID: <000d01c57dab$21871e30$14b2a8c0@wiko> From: "Andreas Rossberg" To: References: <42C4228D.3080000@ps.uni-sb.de> Subject: Re: [Caml-list] bizarre type Date: Thu, 30 Jun 2005 21:37:19 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1506 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 Sender: AndreasRossberg@web.de X-Sender: AndreasRossberg@web.de X-Miltered: at nez-perce with ID 42C449F1.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; rossberg:01 caml-list:01 val:01 compiler:01 bool:01 compiler:01 cheers:01 ...:98 wrote:01 pps:01 jussieu:01 andreas:01 andreas:01 int:01 int:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: From: "Julien Verlaguet" > > # type 'a t=string;; > type 'a t = string > # let g (x : 'a) (y : 'a t)=();; > val g : 'a -> 'a t -> unit = > # g 3;; > - : int t -> unit = > > here we should have int t=string='_a t ... Well, since '_a t = int t the compiler can freely choose either for printing. Or bool t, for that matter. > I strongly disaggree with the fact that the compiler infered the most > general type in this case. > > Because I specified it. > > when you write (let f=fun (x : 'a) (y : 'a) -> (x,y)), you force the type > of x > and y to be equal. Yes, but that's not what you did in the other example. You wrote (x : 'a t) - and because of the way t was defined this was as good as writing (x : string) and hence did not induce any additional constraint. Cheers, - Andreas