From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr 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 CEB82BB81 for ; Sat, 12 Nov 2005 15:19:50 +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 jACEJo1s028066 for ; Sat, 12 Nov 2005 15:19:50 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA20384 for ; Sat, 12 Nov 2005 15:19:50 +0100 (MET) Received: from smtp3-g19.free.fr (smtp3-g19.free.fr [212.27.42.29]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jACEJnbi019423 for ; Sat, 12 Nov 2005 15:19:49 +0100 Received: from [192.168.9.50] (did75-12-82-236-3-6.fbx.proxad.net [82.236.3.6]) by smtp3-g19.free.fr (Postfix) with ESMTP id 9095F373E5 for ; Sat, 12 Nov 2005 15:19:49 +0100 (CET) Message-ID: <4375FACF.3040906@aist.enst.fr> Date: Sat, 12 Nov 2005 15:23:11 +0100 From: Florent User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Re: [Caml-list] strange behavior with record type definition References: <43752259.80800@aist.enst.fr> <4375CAC8.5030803@aist.enst.fr> <1131797575.18524.0.camel@rosella> <4375DDFC.9060802@motion-twin.com> <1131799890.18524.14.camel@rosella> In-Reply-To: <1131799890.18524.14.camel@rosella> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4375FA06.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4375FA05.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 compiler:01 compiler:01 dubuget:01 blabla:01 ...:98 wrote:01 wrote:01 expression:01 explicitly:01 int:01 int:01 defined:01 types:02 let:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Ok but with these two record types defined : type t0 = { x : int ; y : int } ;; type t1 = { x : int } ;; There is no ambiguity about the following expression's type: { x = 0 ; y = 0 } ;; Why can't the t0 type be infered ? And with this function definition, let get_y (t:t0) = t.x ;; I explicitly say to the compiler that t is of type t0, so why does the compiler infer a t1 type when trying to get the x label of a t0 type value ? Matthieur Dubuget wrote : > If there is y.x in your code, and the type t = {x : blabla; ...} was > declared, > then y's type is infered to be of type t Skaller wrote : > So that the type of an expression: > { x = 1; y = 2 } > can be determined.