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
"opening" record types
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-08-21 (22:20)
From: Yaron Minsky <yminsky@c...>
Subject: Re: [Caml-list] "opening" record types
On 8/21/07, Olivier Andrieu <> wrote:

> actually, you can write
>   let y = {Foo.a=3; b=4}
> i.e. you only need the module name on one field of the record, not all

Indeed, at Jane Street, we've come to favor the following idiom:

   let y  = { Module_name.
              field1 = val1;
              field2 = val2;

The module name then works almost like a constructor, so you hardly need the
syntax extension discussed elsewhere in this thread.