From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA13020 for caml-red; Wed, 19 Jul 2000 17:41:57 +0200 (MET DST) 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 MAA17715 for ; Mon, 17 Jul 2000 12:02:00 +0200 (MET DST) Received: from miss.wu-wien.ac.at (miss.wu-wien.ac.at [137.208.107.17]) by concorde.inria.fr (8.10.0/8.10.0) with ESMTP id e6HA20j16144 for ; Mon, 17 Jul 2000 12:02:00 +0200 (MET DST) Received: (from mottl@localhost) by miss.wu-wien.ac.at (8.9.0/8.9.0) id MAA00524; Mon, 17 Jul 2000 12:01:51 +0200 (MET DST) Date: Mon, 17 Jul 2000 12:01:51 +0200 From: Markus Mottl To: =?iso-8859-1?Q?David_Mentr=E9?= Cc: caml-list@inria.fr Subject: Re: [newbie] Define and use records in sum types Message-ID: <20000717120151.A32148@miss.wu-wien.ac.at> References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Mutt/1.2i In-Reply-To: ; from David.Mentre@irisa.fr on Tue, Jul 11, 2000 at 13:32:40 +0200 Sender: weis@pauillac.inria.fr On Tue, 11 Jul 2000, David Mentr=E9 wrote: > I would like to define a sum type with records as constructor > parameters, records with the same field names.=20 It is unfortunately not possible to use records with the same names at the same time without putting them into separate modules. > It *seems* to work but, in fact, the a_rec definition is masked by b_rec > definition: Exactly: names of record fields get overridden by subsequent definitions. There is no way to get the "old" meaning back without the use of modules. > The rationale behind this question: I find records more clear that > tuples in source code. Using records makes sources more readable and also easier to maintain. For example, the "with" statement as in { some_record with some_field =3D some_value; ... } =20 allows adding fields to records without breaking code. Best regards, Markus Mottl --=20 Markus Mottl, mottl@miss.wu-wien.ac.at, http://miss.wu-wien.ac.at/~mottl