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
pattern matching and records vs tuples
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-04-14 (19:57)
From: Christophe Raffalli <christophe.raffalli@u...>
Subject: Re: [Caml-list] pattern matching and records vs tuples

Dear list member,

A solution
 when you change a record (or the meaning of an integer) and want to 
make sure that you are warned by the compiler at
every place where this data is used is to encapsulate your type in a box 
replacing for instance

let x = 0 : int (number of eggs)


let box d = `A(d) and unbox (`A d) = d
let x = box 0 (*nomber of dozen of eggs*)

Once you have updated all your code, you can remove the "box" and "unbox".

It would be nice if all this could be automated ...