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 KAA11823 for caml-redistribution; Wed, 10 Mar 1999 10:20:21 +0100 (MET) 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 WAA12054 for ; Tue, 9 Mar 1999 22:57:14 +0100 (MET) Received: from mail2.digital.com (mail2.digital.com [204.123.2.56]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id WAA02576 for ; Tue, 9 Mar 1999 22:57:12 +0100 (MET) From: doligez@pa.dec.com Received: from six.pa.dec.com (six.pa.dec.com [16.4.80.66]) by mail2.digital.com (8.9.2/8.9.2/WV2.0e) with SMTP id NAA13264; Tue, 9 Mar 1999 13:57:12 -0800 (PST) Received: by six.pa.dec.com; id AA14156; Tue, 9 Mar 1999 13:57:11 -0800 Message-Id: <199903092157.AA14156@six.pa.dec.com> To: Andrew Martin Cc: caml-list@inria.fr Subject: Re: CamlIDL - stub code generator and COM binding for OCaml In-Reply-To: Message of Fri, 05 Mar 1999 14:46:35 -0600 from Andrew Martin <36E042AB.32801982@ibmoto.com> Date: Tue, 09 Mar 1999 13:57:11 -0800 X-Mts: smtp Sender: weis >From: Andrew Martin >How can one deal with two struct types whose members have the same names. >In Ocaml, for example: > >type foo = {a:int; b:int} >type goo ={a:char; b:char} > >How can I now create an object of type foo? It would be nice if I could write >let x = ({a=4; b=5;}:foo) or >let x = {foo.a=4; foo.b=4} or even >let (x:foo) = {a=4; b=4} You can get (almost) your second solution simply by declaring: type foo = {foo_a : int; foo_b : int};; type goo = {goo_a : char; goo_b : char};; Then you can write: let x = {foo_a = 4; foo_b = 4} -- Damien