Why not pass the value of the "x" field directly to the function, instead of trying to receive a would-be { x : 'a; .... } parameter ?
If you would have liked the field to be mutable, make it a reference.

On Wed, Mar 30, 2011 at 2:38 PM, Dawid Toton <d0@wp.pl> wrote:
On 03/28/2011 08:35 PM, Joel Reymont wrote:
> On Mar 28, 2011, at 7:34 PM, David Rajchenbach-Teller wrote:
>
>> you can obtain the same behavior by using objects instead of records:
> Yes, that used to work very well... until I was forced to switch to records :-).
>
When I had this problem I used one common record type:

type ('foo, 'bar') common =
 {foo : 'foo
 ;bar : 'bar
 ;x : int
 }

type with_bar = (unit, string) common
type with_foo = (double, unit) common

However, I can see that with more different independent types this is
going to be quite ugly.

Dawid

--
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs