Browse thread
Re: CamlIDL - stub code generator and COM binding for OCaml
- doligez@p...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | doligez@p... |
| Subject: | Re: CamlIDL - stub code generator and COM binding for OCaml |
>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