Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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