From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA17021; Thu, 22 Mar 2001 13:35:38 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 NAA16093 for ; Thu, 22 Mar 2001 13:35:37 +0100 (MET) Received: from s057.dhcp212-109.cybercable.fr (s057.dhcp212-109.cybercable.fr [212.198.109.57]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f2MCZaT07702 for ; Thu, 22 Mar 2001 13:35:36 +0100 (MET) Received: from baretta.com (IDENT:alex@localhost.localdomain [127.0.0.1]) by s057.dhcp212-109.cybercable.fr (8.9.3/8.9.3) with ESMTP id NAA01349 for ; Thu, 22 Mar 2001 13:34:05 +0100 Message-ID: <3AB9F13C.1B77C08@baretta.com> Date: Thu, 22 Mar 2001 13:34:04 +0100 From: Alex Baretta X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i586) X-Accept-Language: it, en MIME-Version: 1.0 To: "caml-list@inria.fr" Subject: [Caml-list] Records Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Basically I'm trying to define two record type as sharing some field names. I have tried twice, apparently in the same way, and obtained two different error messages, which seem to contradict one another. Could anyone explain to me what is happening here? Objective Caml version 3.00 # type rec1 = { field1 : int } type rec2 = { field1 : int ; field2 : int };; <--- Here I define my two record types type rec1 = { field1 : int; } type rec2 = { field1 : int; field2 : int; } # { field1 = 1 };; <--- This is supposed to be a correct rec1 variable. Some record field labels are undefined <--- Why? rec1 defines field1 # { field2 = 2 };; Some record field labels are undefined <--- Here I agree with the interpreter # { field1 = 1 ; field2 = 2 };; - : rec2 = {field1=1; field2=2} <--- Ok, so apparently he likes records with 2 fields... Now I try again, but this time I begin by defining a record with two fields, and then I define a second one which shares one of them. # type var_def_rec = {name: string; value: int} type var_decl_rec= {name: string} ;; type var_def_rec = { name : string; value : int; } type var_decl_rec = { name : string; } <--- Ok, so he accepted them. # { name = "alex" ; value = 1 };; The record field label value belongs to the type var_def_rec but is here mixed with labels of type var_decl_rec <--- Hein! What? # { name = "pippo" };; - : var_decl_rec = {name="pippo"} <--- Now he seems to like records with one field only! WHY? I cannot make any sense out of this. Please, help me. Alex ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr