From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 965E6BC69 for ; Thu, 22 Feb 2007 16:50:37 +0100 (CET) Received: from pih-relay06.plus.net (pih-relay06.plus.net [212.159.14.133]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1MFoac7017178 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 22 Feb 2007 16:50:37 +0100 Received: from [80.229.56.224] (helo=beast.local) by pih-relay06.plus.net with esmtp (Exim) id 1HKGDL-00075B-JQ for caml-list@yquem.inria.fr; Thu, 22 Feb 2007 15:50:36 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Feature request : Tuples vs. records Date: Thu, 22 Feb 2007 15:44:07 +0000 User-Agent: KMail/1.9.5 References: <45DD6F8C.7080508@ens-lyon.org> <1172148077.5345.18.camel@rosella.wigram> <45DDA0BF.2000807@ens-lyon.org> In-Reply-To: <45DDA0BF.2000807@ens-lyon.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200702221544.07719.jon@ffconsultancy.com> X-Miltered: at concorde with ID 45DDBBCC.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml's:01 ocaml:01 ocaml:01 frog:98 wrote:01 abstract:01 syntactic:01 slower:01 typing:01 typing:01 caml-list:01 functions:01 tuples:01 tuples:01 pairs:01 On Thursday 22 February 2007 13:55, David Teller wrote: > Yes, that's actually the only real difference I see between records and > tuples. I have the feeling that every other difference is just syntactic > sugar. > > Now, unless I'm mistaken, OCaml's design is mostly towards structural > typing. Usually, when one wants nominal typing, one resorts to abstract > types safely hidden in modules. From this point of view, nominal typing > of records is therefore somewhat surprising. > > Am I getting something wrong ? Structural typing is weaker. So tuples are only suitable for simple cases (primarily returning pairs of values from functions). Whenever things get complicated (>3 fields) you should switch to records. Structural typing is often slower. So records are preferable when performance is critical. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists