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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 3C899BB81 for ; Fri, 11 Nov 2005 23:56:20 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jABMuJXT032411 for ; Fri, 11 Nov 2005 23:56:20 +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 XAA01987 for ; Fri, 11 Nov 2005 23:56:19 +0100 (MET) Received: from smtp6-g19.free.fr (smtp6-g19.free.fr [212.27.42.36]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jABMuJQn032408 for ; Fri, 11 Nov 2005 23:56:19 +0100 Received: from [192.168.9.50] (did75-12-82-236-3-6.fbx.proxad.net [82.236.3.6]) by smtp6-g19.free.fr (Postfix) with ESMTP id F0A93966C for ; Fri, 11 Nov 2005 23:56:18 +0100 (CET) Message-ID: <43752259.80800@aist.enst.fr> Date: Fri, 11 Nov 2005 23:59:37 +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: strange behavior with record type definition Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 43752193.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43752193.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; compiler:01 define:01 int:01 int:01 defined:01 match:02 match:02 labels:02 types:02 types:02 string:03 string:03 float:03 float:03 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 Hi, I have defined two distinct record's types with a field's name in common. But when I try to define a function that uses the first of the types, the compiler gives me a type error. How can I use my first type in a function ?? This is what I did: # type t0 = { i : int ; s : string };; type t0 = { i : int; s : string; } # type t1 = { i : int ; f : float };; type t1 = { i : int; f : float; } # let f (x:t0) = match x with {i= a; s= b} -> b;; Characters 28-40: let f (x:t0) = match x with {i= a; s= b} -> b;; ^^^^^^^^^^^^ The record field label s belongs to the type t0 but is here mixed with labels of type t1 #