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.8 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 5F1F3BBAF for ; Fri, 9 Oct 2009 08:29:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4BAAt1zkpRZ90wkWdsb2JhbACbAwEBAQEJCwoHEwO/FYQqBA X-IronPort-AV: E=Sophos;i="4.44,530,1249250400"; d="scan'208";a="37889358" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail1-smtp-roc.national.inria.fr with ESMTP; 09 Oct 2009 08:29:55 +0200 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20091009062954.IJSC27507.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Fri, 9 Oct 2009 07:29:54 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20091009062954.MSZH2093.aamtaout03-winn.ispmail.ntl.com@romulus.metastack.com>; Fri, 9 Oct 2009 07:29:54 +0100 Received: from Tenor ([172.16.0.8]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id n996TZnx029393 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 9 Oct 2009 07:29:37 +0100 From: "David Allsopp" To: Cc: "'Jon Harrop'" , References: <4ACB319A.1080608@wanadoo.fr> <003901ca4682$d47f8460$7d7e8d20$@metastack.com> <200910061415.48065.jon@ffconsultancy.com> <005501ca468d$dc9b51a0$95d1f4e0$@metastack.com> <87ljjmxdsc.fsf@frosties.localdomain> In-Reply-To: <87ljjmxdsc.fsf@frosties.localdomain> Subject: RE: [Caml-list] Constructors are not functions Date: Fri, 9 Oct 2009 07:29:34 +0100 Message-ID: <003501ca48a9$dfdf80c0$9f9e8240$@metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcpIFMLnkERb+4vkTbyuXLpA60L9BwAkyheQ Content-Language: en-gb Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.0 c=1 a=Mv2A4AzjtYwA:10 a=7kL3DDBV6pEMzmMviC0A:9 a=RWlSFQqCEJUZLnv0LCRGP7TRfl8A:4 X-Spam: no; 0.00; constructors:01 foo:01 constructors:01 arbitrarily:01 ocaml:01 syntax:01 wrote:01 caml-list:01 functions:01 functions:01 constructor:01 int:01 int:01 interfaces:01 variant:02 Goswin von Brederlow wrote: > Then what about > > type t1 = Bar of int * int > type t2 = Foo of (int * int) > > If you treat constructors as functions taking one argument then But why (so arbitrarily) do this? > t1: int * int -> t1 > t2: int * int -> t2 If you look at each type definition and choose those most appropriate, then: t1: int -> int -> t1 t2: int * int -> t2 I don't see your point (but this is pre-coffee!)? The fact that you write [Bar(1, 2)] for a two-constructor variant tag and [bar 1 2] for a "2 argument" function is just an (occasionally irritating) oddity of the OCaml syntax - it wouldn't have to affect any derived constructor functions here. However, the impracticality of importing the types from other interfaces (see Richard Jones post in this thread) has already revealed that this couldn't be done transparently in the way I'd initially thought so it's become a bit of a thought experiment anyway :o) David