Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Records with same structure in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-04-07 (08:54)
From: Oliver Bandel <oliver@f...>
Subject: [Caml-list] Records with same structure in OCaml

when I use two records with the same structure,
how can they be distinguished? And how can
the correct type be choosed?


type complex = { re: float; im: float };
type foo     = { re: float; im: float };

let x = { re =2.0; im = 55.0 };

The x here has type foo.
How can I choose type complex?

Doesn't that yield a mess, when calling
functions with that values?

I tried some things on the toplevel,
and it seems messy to me.

How will that be handled in Ocaml?
Is it not good to have two types with
same structure?


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: