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: Lukasz Stafiniak <lukstafi@g...>
Subject: Re: [Caml-list] Feature request : Tuples vs. records
On 2/23/07, Lukasz Stafiniak <lukstafi@gmail.com> wrote:
> On 2/23/07, Jon Harrop <jon@ffconsultancy.com> wrote:
> > On Thursday 22 February 2007 16:16, David Teller wrote:
> > > I'm more concerned about having to
> > > * declare every record type I use -- that looks to me clumsy and Java-like
> > > * differenciate between records and tuples during pattern-matching
> >
> > The same can be said of ordinary and polymorphic variants. You must declare
> > ordinary variants. You must distinguish between the two in patterns.
> >
I have this idea... We could have row polymorphism in tuples, without
any impact on performance! Instead of insisting that ('a * 'b) means
exactly two elements, we could have (> 'a * 'b) at least two elements.
Any projections or pattern matching fetches the tuple fields without
problems: it doesn't need to care that there are more than it needs.

Say you realize that you need to return another value from a function
(which already returns a tuple): you would only modify the function
and not its uses.