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
Records misbehaviour
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-09-14 (00:02)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Records misbehaviour
From: Lukasz Stafiniak <>

> #type t1 = {fst:int;snd:int};; 
> #let p1 = {fst=1; snd=2};; 
> #type t2 = {snd:int};; 
> #{p1 with snd=4};; 
> - : t2 = {snd = 4};; 

Indeed, this is rather counter-intuitive.
So a bug report would be welcome :-)

Note however that there is no unsoundness here: the definition of
"with" happens to be "create a record with the provided fields,
extracting omitted ones from p1". If none are omitted, which is the
case here as t2 has only one field, then p1 is currently ignored.

Jacques Garrigue