English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 <lukstafi@gmail.com>

> #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