From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id C03447FD26 for ; Fri, 6 Nov 2015 13:29:11 +0100 (CET) IronPort-PHdr: 9a23:JEROkhJs7+DCssAC1NmcpTZWNBhigK39O0sv0rFitYgUI/jxwZ3uMQTl6Ol3ixeRBMOAu68C07KempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lR8iK14ye7KObxd76W01wnj2zYLd/fl2djD76kY0ou7ZkMbs70RDTo3FFKKx8zGJsIk+PzV6nvp/jtLYqySlbuuog+shcSu26Ov1gFf0LOg87KHg479HHshzKTA3HpidNEzZerh0dSTPC4R7mRJDp9mPft+F90SSed4WiSLE/WT2v6+FwTxLnlD0ALxY49n3ajop7i6cN8zy7oBkq4YnSaZrdFvd4Za7bNYcYR0JARd1MSmpKBYbqPNhHNPYIIesN99q1nFAJtxbrQFT1CQ== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jj@issuu.com; spf=Pass smtp.mailfrom=jj@issuu.com; spf=None smtp.helo=postmaster@mail-lf0-f44.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jj@issuu.com) identity=pra; client-ip=209.85.215.44; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jj@issuu.com"; x-sender="jj@issuu.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of jj@issuu.com designates 209.85.215.44 as permitted sender) identity=mailfrom; client-ip=209.85.215.44; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jj@issuu.com"; x-sender="jj@issuu.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lf0-f44.google.com) identity=helo; client-ip=209.85.215.44; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jj@issuu.com"; x-sender="postmaster@mail-lf0-f44.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BfAABvnDxWmyzXVdFehA5vBq5WkTchhW8CgTIHOxEBAQEBAQEBARABAQEBAQYLCwkhLoIuggcBAQEDARIRHQEBByULAQQLCwsNAgIJHQICIhIBBQEKEgYTEhCHdwMKCA2iWIExPjGKV3GEYwEFh0MDhEgBAQEBAQEBAQIBAQEBAQEBAQEUBgp3hVOEfoRZgxwvgRWGEAyQMYUdiAeBW0mHHJE3EiSBFzeCMA0WB4FXPTSFFAEBAQ X-IPAS-Result: A0BfAABvnDxWmyzXVdFehA5vBq5WkTchhW8CgTIHOxEBAQEBAQEBARABAQEBAQYLCwkhLoIuggcBAQEDARIRHQEBByULAQQLCwsNAgIJHQICIhIBBQEKEgYTEhCHdwMKCA2iWIExPjGKV3GEYwEFh0MDhEgBAQEBAQEBAQIBAQEBAQEBAQEUBgp3hVOEfoRZgxwvgRWGEAyQMYUdiAeBW0mHHJE3EiSBFzeCMA0WB4FXPTSFFAEBAQ X-IronPort-AV: E=Sophos;i="5.20,252,1444687200"; d="scan'208";a="186389025" Received: from mail-lf0-f44.google.com ([209.85.215.44]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 06 Nov 2015 13:29:10 +0100 Received: by lfs39 with SMTP id 39so41329398lfs.3 for ; Fri, 06 Nov 2015 04:29:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=issuu.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ymt+UAtVoXCEObykuVDCmdLFI/9FiQmXUndf3YfhDSg=; b=C4NES6Pqo2mW8jxoE7d5vFYu/KnyRm/yMwM75iEz5foh+ZEGiJSWd0v6rTGMhFFxxM Ow3RIQ/0UrH/H3L8fPllBmYmqjBLibsB8/2dBFI/A2DuRacdXkVQyQMrSX+d7mFOxWjT ng8jhXLY1Liw3r5SJLb9A9F3C7W64+LVX3y6s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=ymt+UAtVoXCEObykuVDCmdLFI/9FiQmXUndf3YfhDSg=; b=Xw+0g0u+3TyU8VuGK/cww6NN8K1Q207/OFMQh1scbTh4SBiwvGOip0g4iaVdMELbhE rFIhPGhdWoARoeduwMvy9InjqwBQ9msgMUu4LfzR/Wzf8sOTJoGwb/izbSBjfPHZjrrx iw5C6lAeNKSxQCkUQG3raNGV1w1PH4UZlp1062oGos06xBFqbKMKQ2cVMqb5kbIjpk1/ y2UJFGi0ZVPTQ2e5Afc42aDLeXOCnhpfSu/gS8u2tebtVF9zn0LIZdMDX4GY7Q3d1MO8 u/RjRWBqB8fBSPrjnVOMSUUtjSGs3hicgAmvS9jPkqe5hi1aW+5f43EOLZ0rOMOpqH74 g0DQ== X-Gm-Message-State: ALoCoQmHMGy5q9WjN/sEJbRoazLmS2AY19A7dy4+0RBr+fJGv1h9HgBV+x2yX4690Bn3TMavHQhh MIME-Version: 1.0 X-Received: by 10.25.162.5 with SMTP id l5mr4023303lfe.70.1446812949937; Fri, 06 Nov 2015 04:29:09 -0800 (PST) Received: by 10.25.201.8 with HTTP; Fri, 6 Nov 2015 04:29:09 -0800 (PST) In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> Date: Fri, 6 Nov 2015 13:29:09 +0100 Message-ID: From: Jonas Jensen To: "Soegtrop, Michael" Cc: "caml-list@inria.fr" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Newbie comment on constructor syntax If you're feeling adventurous, you can try Jun Furuse's ppx extension that enables curried and partially-applied constructors: https://bitbucket.org/camlspotter/ppx_curried_constr On 6 November 2015 at 10:33, Soegtrop, Michael wrote: > > Dear Ocaml users, > > I just started to develop in OCaml, and must say it is smoother than expe= cted. Although I did C/C++ for decades, I do less errors in Ocaml, both syn= tactically and in terms of if programs behave as expected. It appears to be= much closer to human thinking than C/C++ and I already wonder how I could = live without currying and type inference before. > > The one thing I find rather non intuitive is that variant constructors ca= n take only one argument - or a tuple. Although I know it is wrong, I alway= s write "Constr a b" instead of "Constr (a, b)". I know syntax is only a mi= nor thing and mostly a matter of taste, but a large fraction of my syntax e= rrors in new code are of this kind (when modifying code it is a bit differe= nt). Somehow I think this doesn't go together well with the function call s= yntax of OCaml. I guess deep in my brain a constructor is a function which = takes arguments and returns an element of the type it constructs, so I gues= s I want to use the usual function call syntax. > > My question: Is there some syntax to give a constructor more than one arg= ument which escaped me? Something like if I leave away the * in the definit= ion I can use usual function call syntax in constructions and expressions? = I would find this easier to read and to write, especially in matches or nes= ted constructs. Does everybody use camlp4/p5/ppx to customize the syntax to= his liking (as chapter 5 of the camlp4 manual suggests)? Or are there some= long term advantages of this syntax I don't see as yet? > > Best regards, > > Michael > > Intel Deutschland GmbH > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Christian Lamprechter > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928 > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs