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: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Feature request : Tuples vs. records
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.

Similarly, polymorphic variants (that are structurally typed and provide more 
inference) weaken the type system. The main disadvantage of this is in 
reporting errors, which become prohibitively obfuscated.

> * having to learn/teach two different implementations of what is
> essentially the same concept

Although tuples and records are both product types, I think people have cited 
several fundamental differences between them: typing, performance, robustness 
etc.

> * having to learn/teach that third meaning of operator = (the first one
> being comparison between values and the second one being its use in let
> x = ...).

You would rather teach another use of ":"?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists