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
Feature request : Tuples vs. records
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-22 (15:28)
From: Andreas Rossberg <rossberg@p...>
Subject: Re: [Caml-list] Feature request : Tuples vs. records
skaller wrote:
>> By the way, I always wondered why ocaml doesn't have generic projection 
>> operations from cartesian products (I belive they are writen #1, #2, #3 
>> ... in SML).
> There's another difference in Ocaml: records
> are nominally typed, tuples are structurally typed.

In fact, these are closely related. In SML, tuples *are* records: the 
syntax (x,y) is merely syntactic sugar for {1=x, 2=y}, where 1 and 2 are 
numeric labels. Record projection #lab thus naturally applies to tuples. 
However, that definition of tuples requires structural record typing.

Andreas Rossberg, rossberg@ps.uni-sb.de