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.4 required=5.0 tests=AWL,DNS_FROM_RFC_ABUSE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id D6F07BBC4 for ; Fri, 17 Apr 2009 02:26:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEABBp50mCNhAB/2dsb2JhbADQMYN9Bg X-IronPort-AV: E=Sophos;i="4.40,201,1238968800"; d="scan'208";a="38608961" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 17 Apr 2009 02:26:30 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id n3H0QOZV010203; Fri, 17 Apr 2009 09:26:25 +0900 (JST) Date: Fri, 17 Apr 2009 09:26:28 +0900 (JST) Message-Id: <20090417.092628.161183757.garrigue@math.nagoya-u.ac.jp> To: dra-news@metastack.com Cc: goswin-v-b@web.de, caml-list@inria.fr Subject: Re: [Caml-list] pattern matching and records vs tuples From: Jacques Garrigue In-Reply-To: <000b01c9beb4$ac3d50a0$04b7f1e0$@com> References: <49E53C8A.1090601@naughtydog.com> <87tz4opori.fsf@frosties.localdomain> <000b01c9beb4$ac3d50a0$04b7f1e0$@com> X-Mailer: Mew version 5.2 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ocaml:01 tohoku:01 val:01 val:01 compiler:01 sml:01 sml:01 caml-list:01 tuples:01 string:02 garrigue:03 garrigue:03 jacques:03 jacques:03 pattern:04 From: "David Allsopp" > The other worry in the back of my mind is that despite having > considerably more flexible records in SML (you don't have to declare > the types in advance and label sharing is possible), a function in > SML still has the restriction of only being over a fixed record > type... and when SML has odd restrictions, they're usually to do with > the more "obvious" type system feature being undecideable. For > example, you can't say in SML: > > fun get_x r = #x r; > > as the equivalent of the OCaml get_x you propose. You can do this with SML# http://www.pllab.riec.tohoku.ac.jp/smlsharp/ # fun f x = #name x; val f = fn : ['a, 'b#{name:'a}. 'b -> 'a] # f {name = "Joe", age = 21}; val it = "Joe" : string But the compiler is rather clever... Jacques Garrigue