Version française
Home     About     Download     Resources     Contact us    
Browse thread
"opening" record types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe TROESTLER <Christophe.Troestler+ocaml@u...>
Subject: Re: [Caml-list] "opening" record types
On Tue, 21 Aug 2007 09:18:02 -0400, Yitzhak Mandelbaum wrote:
> 
> let y = {Foo.a=3; Foo.b=4}
> 
> Is there any way around this?  That is, is there any way to use the  
> field names of a record defined in another module without opening the  
> whole module or copying the whole definition of the record.

No because the record {a,b} may also be defined in another module and
you need to tell which one to use.  However, you can put the
qualification only once :

let y = {Foo.a=3; b=4}

Of course, if [Foo] name is long, you can alias it at the beginning of
your code :

module F = Very.Long.Module.Name

Cheers,
ChriS