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=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id EF325BC6B for ; Thu, 22 Feb 2007 11:25:37 +0100 (CET) Received: from dedibox1.ambre.net (dedibox1.ambre.net [88.191.29.66]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1MAPbK4006909 for ; Thu, 22 Feb 2007 11:25:37 +0100 Received: from [81.185.98.193] (unknown [81.185.98.193]) by dedibox1.ambre.net (Postfix) with ESMTP id 4A649C4000B for ; Thu, 22 Feb 2007 11:25:37 +0100 (CET) Message-ID: <45DD6F8C.7080508@ens-lyon.org> Date: Thu, 22 Feb 2007 11:25:16 +0100 From: David Teller User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Feature request : Tuples vs. records Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 45DD6FA1.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ens-lyon:01 constructors:01 ocaml:01 ocaml:01 syntaxes:01 equality:01 functions:01 tuples:01 tuples:01 pair:01 pair:01 int:01 int:01 data:02 match:02 A long time ago, I used to believe that there was a large difference between tuples and records: tuples constructors/patterns use the order of their arguments to determine where they fit in the data structure, while records use the name of arguments. And then, labels arrived and somehow made possible to use either style when it comes to defining and applying functions. Now, of course, I have the task of teaching OCaml to students. When it comes to explaining the difference between tuples and records, I'm suddenly unsure. Why is there a difference at all ? Aren't records the same thing as tuples with labels ? Couldn't/shouldn't the next version of OCaml uniformize both syntaxes and get us rid of {} once and for all ? 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