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.2 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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 60E29BBAF for ; Tue, 6 Oct 2009 14:37:38 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AocBAETXykrUnwckimdsb2JhbACCIJhXAQEBCgkMBxEGt3CEKgQ X-IronPort-AV: E=Sophos;i="4.44,513,1249250400"; d="scan'208";a="37656465" Received: from relay.ptn-ipout02.plus.net ([212.159.7.36]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Oct 2009 14:37:38 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AroFAETXykrUnw6U/2dsb2JhbACCINEHhCoE Received: from fhw-relay07.plus.net ([212.159.14.148]) by relay.ptn-ipout02.plus.net with ESMTP; 06 Oct 2009 13:37:37 +0100 Received: from [87.114.87.187] (helo=leper.local) by fhw-relay07.plus.net with esmtp (Exim) id 1Mv9IP-00027P-7u for caml-list@yquem.inria.fr; Tue, 06 Oct 2009 13:37:37 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Constructors are not functions Date: Tue, 6 Oct 2009 13:38:20 +0100 User-Agent: KMail/1.9.9 References: <4ACB319A.1080608@wanadoo.fr> <4d1b2df20910060519n920bccaud71c0d28f9ce5269@mail.gmail.com> In-Reply-To: <4d1b2df20910060519n920bccaud71c0d28f9ce5269@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200910061338.20954.jon@ffconsultancy.com> X-Plusnet-Relay: 9d38541c3277c8fe4ff1ea47d6c3cf27 X-Spam: no; 0.00; constructors:01 semantics:01 semantics:01 constructors:01 2009:98 frog:98 wrote:01 partial:01 partial:01 caml-list:01 functions:01 int:01 expression:02 match:02 match:02 On Tuesday 06 October 2009 13:19:58 Philippe Wang wrote: > Hello, > > I don't know the actual reason, but I guess it's simply a choice of > semantics. > > It woud be weird to be able to deconstruct (Bar 42) while not be able > to deconstruct (Bar) as it's not constructed. > I mean we can write (match x with Bar y -> y). > If partial construction were accepted we may like to write > (match x with Bar -> x) but we couldn't because Bar is like a function > then. > > With type t = A | B of int > what would be the error warning for > (match x with A -> 42 | B -> 43) ? > > Well, then I guess the reason is that it would be complicated to > choose some sound enough semantics for partial application of > constructors, since the solution of having to write (fun x -> Bar x) > is much simpler. Can you not just say that Bar in an expression is a function (fun x -> Bar x)? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e