From: doligez@pa.dec.com
To: Andrew Martin <amartin@ibmoto.com>
Cc: caml-list@inria.fr
Subject: Re: CamlIDL - stub code generator and COM binding for OCaml
Date: Tue, 09 Mar 1999 13:57:11 -0800 [thread overview]
Message-ID: <199903092157.AA14156@six.pa.dec.com> (raw)
In-Reply-To: Message of Fri, 05 Mar 1999 14:46:35 -0600 from Andrew Martin <amartin@ibmoto.com> <36E042AB.32801982@ibmoto.com>
>From: Andrew Martin <amartin@ibmoto.com>
>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
prev parent reply other threads:[~1999-03-10 9:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-05 10:41 Xavier Leroy
1999-03-05 20:46 ` Andrew Martin
1999-03-08 9:41 ` Sven LUTHER
1999-03-09 16:07 ` Xavier Leroy
1999-03-09 18:54 ` Andrew Martin
1999-03-12 10:47 ` Thierry Bravier
1999-03-10 9:11 ` Pierre Weis
1999-03-10 9:43 ` Jacques GARRIGUE
1999-03-09 21:57 ` doligez [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199903092157.AA14156@six.pa.dec.com \
--to=doligez@pa.dec.com \
--cc=amartin@ibmoto.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox