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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 6224CBBAF for ; Tue, 6 Oct 2009 16:04:08 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8BAC/rykpRZ90vkWdsb2JhbACadwEBAQEJCwoHEwO4GoQqBIFT X-IronPort-AV: E=Sophos;i="4.44,513,1249250400"; d="scan'208";a="48056610" Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Oct 2009 16:04:08 +0200 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20091006140407.GCJR17029.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Tue, 6 Oct 2009 15:04:07 +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 <20091006140407.YSQT2093.aamtaout03-winn.ispmail.ntl.com@romulus.metastack.com>; Tue, 6 Oct 2009 15:04:07 +0100 Received: from Tenor ([172.16.0.8]) (authenticated bits=0) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id n96E43W8024299 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 6 Oct 2009 15:04:04 +0100 From: "David Allsopp" To: "'Jon Harrop'" , References: <4ACB319A.1080608@wanadoo.fr> <003901ca4682$d47f8460$7d7e8d20$@metastack.com> <200910061415.48065.jon@ffconsultancy.com> In-Reply-To: <200910061415.48065.jon@ffconsultancy.com> Subject: RE: [Caml-list] Constructors are not functions Date: Tue, 6 Oct 2009 15:04:02 +0100 Message-ID: <005501ca468d$dc9b51a0$95d1f4e0$@metastack.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcpGhwpARxicM9tuSZqP3uI3skGnHAABgpXQ 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=vvWcEpErSfkZkozAT9wA:9 a=0p1LYviHxrSDf2p8KRpipNT-KtMA:4 X-Spam: no; 0.00; constructors:01 simulate:01 ocaml:01 camlp:01 foo:01 constructors:01 camlp:01 cmi:01 sml:01 unbound:01 wrote:01 wrote:01 caml-list:01 functions:01 int:01 Jon Harrop wrote: > David Allsopp wrote: > > I think it would be possible to simulate the SML behaviour in OCaml > > using camlp4 (if you assume that for [type foo =3D Bar of int] that = future > > unbound references to [bar] are interpreted as [fun x -> bar x] = instead of an > > error) >=20 > Only if you turned multi-argument type constructors into single- > argument ones > taking a tuple, i.e. type definitions like: >=20 > type t =3D Bar of int * int >=20 > must become: >=20 > type t =3D Bar of (int * int) That's not the case at all - there'd be no reason not to interpret [bar] = as [fun x y -> Bar(x, y)] for [Bar of int * int]. What would be hairy in = camlp4 would be having to read .cmi files to deal with types defined = outside your source file, but that's still not impossible... David=20