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
OCaml 3.12.0+beta1
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-06-24 (17:45)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] OCaml 3.12.0+beta1
Florent Ouchet wrote:
> Hello,
> No problem so far with 3.12.0b1 but...
> Damien Doligez a écrit :
>> - Record patterns of the form { lbl = pat; _ } to mark that not all
>>   labels are listed, purposefully.  (See new warning below.)
> This modification heavily breaks backward compatibility with OCaml 3.11.
> You should provide some preprocessing scripts to strip these extra "_".

I disagree.  The syntax is a new and optional feature.  Authors who want their
new code to compile with an earlier version of OCaml should simply avoid using
the new feature, as always.

Finally we'll be able to use pattern matching on records for real and it's
really cool.  That means we can use records where we used to prefer tuples,
typically on things like tree nodes.  It will make it easier to add fields
when the code evolves, compared to tuples.

Tuple version:

  let loc, _, _, name, _ = x in ...

Record version:

  let { loc; name; _ } = x in ...

Old record version:

  let { loc = loc; name = name } = x in ...