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 76CA8BCAE for ; Thu, 30 Jun 2005 18:49:21 +0200 (CEST) Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j5UGnLWu017098 for ; Thu, 30 Jun 2005 18:49:21 +0200 Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.13.4/2005060800) with ESMTP id j5UGnKqt011420 for ; Thu, 30 Jun 2005 18:49:20 +0200 (CEST) Received: from mail.cs.uni-sb.de (mail.cs.uni-sb.de [134.96.254.200]) by cs.uni-sb.de (8.13.4/2005033000) with ESMTP id j5UGnJGU000339 for ; Thu, 30 Jun 2005 18:49:20 +0200 (CEST) Received: from ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by mail.cs.uni-sb.de (8.13.4/2005060800) with ESMTP id j5UGnJWn026252 for ; Thu, 30 Jun 2005 18:49:19 +0200 (CEST) X-Authentication-Warning: mail.cs.uni-sb.de: Host grizzly.ps.uni-sb.de [134.96.186.68] claimed to be ps.uni-sb.de Received: from [134.96.186.172] (groove.ps.uni-sb.de [134.96.186.172]) by ps.uni-sb.de (8.12.10/8.12.10) with ESMTP id j5UGnIJU015029; Thu, 30 Jun 2005 18:49:18 +0200 Message-ID: <42C4228D.3080000@ps.uni-sb.de> Date: Thu, 30 Jun 2005 18:49:17 +0200 From: Andreas Rossberg User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] bizarre type References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 42C42291.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; rossberg:01 rossberg:01 caml-list:01 val:01 annotation:01 compiler:01 infers:01 cheers:01 wrote:01 uni-sb:01 uni-sb: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=1.1 required=5.0 tests=ITS_LEGAL autolearn=disabled version=3.0.2 X-Spam-Level: * Julien Verlaguet wrote: > I would like to know if the following behavior is normal : > > type 'a t=string ;; > > # let g (x : 'a t) (y : 'a)=();; > val g : 'a t -> 'a -> unit = > > # g ("hello" : int t);; > - : '_a -> unit = > > I was expecting: (int -> unit). Since int t = string = '_a t or more generally, x t = y t for any x and y, your type annotation does not induce anything about the instantiation of g's variable 'a. The following is perfectly legal: g ("hello" : int t) true The compiler just infers the most general type. Cheers, - Andreas -- Andreas Rossberg, rossberg@ps.uni-sb.de Let's get rid of those possible thingies! -- TB