Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] 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: Frederic GAVA <frederic.gava@w...>
Subject: Re: [Caml-list] Feature request : Tuples vs. records
Hi David,

Another difference is that (If I remember) record of float are unboxed and not tuple of float. But perhaps it could be done.

Also, I do understand the true difference between write
{x=1;y=2} (9 caracters) and (~x:1,~y:2) (11 caracters) except syntaxic one (I thinks that = is simpler that : which is more for type)

Frédéric Gava



> I envision something like
> # (1,2);;
> - : int * int = (1, 2)
> 
> # let pair_2 = (~x:1, ~y:2);;
> pair_2 : x:int * y:int = (1, 2)
> 
> # let pair_3 = (~y:2, ~x:1);;
> pair_3 : y:int * x:int = (2, 1)    (*or perhaps normalisation, say based 
> on the lexicographical order of labels*)
> 
> # pair_2 = pair_3;; (*structural equality*)
> true
> 
> # match pair_2 with (~y:y, ~x:x) -> (x,y);;
> - : int * int = (1, 2)
> 
> 
> Is anything such considered ?
> 
> Thanks,
>  David
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
>