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_FAIL 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 ACAF9BBAF for ; Tue, 6 Oct 2009 15:39:01 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al8DAFLlykpQRFuwWWdsb2JhbACabQEWFbhChCoE X-IronPort-AV: E=Sophos;i="4.44,513,1249250400"; d="scan'208";a="37662384" Received: from furbychan.cocan.org ([80.68.91.176]) by mail1-smtp-roc.national.inria.fr with ESMTP; 06 Oct 2009 15:39:01 +0200 Received: from rich by furbychan.cocan.org with local (Exim 4.63) (envelope-from ) id 1MvAFm-0003dX-OP; Tue, 06 Oct 2009 14:38:58 +0100 Date: Tue, 6 Oct 2009 14:38:58 +0100 To: Jon Harrop Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Constructors are not functions Message-ID: <20091006133858.GA13733@annexia.org> References: <4ACB319A.1080608@wanadoo.fr> <4d1b2df20910060519n920bccaud71c0d28f9ce5269@mail.gmail.com> <200910061338.20954.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200910061338.20954.jon@ffconsultancy.com> User-Agent: Mutt/1.5.13 (2006-08-11) From: Richard Jones X-Spam: no; 0.00; constructors:01 0100,:01 semantics:01 semantics:01 constructors:01 2009:98 2009:98 wrote:01 wrote:01 partial:01 partial:01 caml-list:01 functions:01 int:01 expression:02 On Tue, Oct 06, 2009 at 01:38:20PM +0100, Jon Harrop wrote: > 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)? This is what standard ML seems to do. Rich. -- Richard Jones Red Hat