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
different records, same field name?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-03-03 (23:24)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] different records, same field name?
On Monday 03 March 2008 19:32:02 Kuba Ober wrote:
> I think that type inference in OCaml sometimes gets in the way of other
> language features. I'd much rather see OCaml go in a direction where type
> inference is performed on "as far as it can go" basis.

Other languages already do that, of course, and it just brings a different set 
of trade-offs. OCaml is roughly the best you can get in this respect.

Breaking decideability seems like a bad idea because you end up annotating all 
types and benefitting much less from type inference, as is idiomatic in 
Haskell and imposed in Scala.

The alternative of flagging an error when an ambiguity arises is used by F# 
but it makes no attempt to search current definitions for structurally- 
compatible classes. Indeed, I already find it confusing and a little ugly to 
have to add type annotations as you develop because your final product often 
ends up with unnecessary annotations as later developments remove 

Dr Jon D Harrop, Flying Frog Consultancy Ltd.