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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 3E4787FD26 for ; Fri, 6 Nov 2015 11:04:40 +0100 (CET) IronPort-PHdr: 9a23:7Pw1mheBOKshnIdX1Qvorkz9lGMj4u6mDksu8pMizoh2WeGdxc+5bR7h7PlgxGXEQZ/co6odzbGG7ua4ASQp2tWojjMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB89YVVVorDmROElRH9viNRWJ+iXhpQAbFhi3DwdpPOO9QteU1JTqkbjqs7ToICx2xxOFKYtoKxu3qQiD/uI3uqBFbpgL9x3Sv3FTcP5Xz247bXianhL7+9vitMU7q3cYk7sb+sVBSaT3ebgjBfwdVWx+cjN92Mq+/yLEQAST/HwEFi0zkxFICgXBplmuW5b6siL3sqxm3ySVIdfxVZg1Xyiv6+FgTxq+zG9NPDc89CTTi9dspKNduhOo4RJlicaAa4iQML96f7jBVdIcX2tIGMhLAX9vGIS5Oq0OBO0FNP0QiIvwq1JGhxKkTV2qBejozjZTwHj00KEzle4oCynC0RwhEdNIu3PR+oamfJwOWPy4mfGbhQ7IaOlbjHKksNDF Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=nicolas.ojeda.bar@lexifi.com; spf=None smtp.mailfrom=nicolas.ojeda.bar@lexifi.com; spf=None smtp.helo=postmaster@mx30.yaziba.net Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=pra; client-ip=82.138.71.21; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=mailfrom; client-ip=82.138.71.21; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mx30.yaziba.net) identity=helo; client-ip=82.138.71.21; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="postmaster@mx30.yaziba.net"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BfAAA9ejxWnBVHilJehA5vwA0jhTM6AoE2PBABAQEBAQEBARABAQEBAQgLCQkhLoIugggBAQQ4EUALGAklDwJGBgEMCAEBiC4JwRoBAQgBAQEBH4ZVhH2JOQWSZ4NhhR2IB4FbSYZ5I5MCAjiCPBYHgVdxAQGFEgEBAQ X-IPAS-Result: A0BfAAA9ejxWnBVHilJehA5vwA0jhTM6AoE2PBABAQEBAQEBARABAQEBAQgLCQkhLoIugggBAQQ4EUALGAklDwJGBgEMCAEBiC4JwRoBAQgBAQEBH4ZVhH2JOQWSZ4NhhR2IB4FbSYZ5I5MCAjiCPBYHgVdxAQGFEgEBAQ X-IronPort-AV: E=Sophos;i="5.20,251,1444687200"; d="scan'208";a="152888665" Received: from mx30.yaziba.net ([82.138.71.21]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 06 Nov 2015 11:04:39 +0100 Received: from mta10.int.yaziba.net (unknown [217.117.151.14]) by mx30.yaziba.net (mx10.yaziba.net) with ESMTP id 35F231A744B; Fri, 6 Nov 2015 11:04:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id 6B1201389C2; Fri, 6 Nov 2015 11:04:38 +0100 (CET) X-Virus-Scanned: amavisd-new at mta10.int.yaziba.net Received: from mta10.int.yaziba.net ([127.0.0.1]) by localhost (mta10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id veyK4kVjknhm; Fri, 6 Nov 2015 11:04:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mta10.int.yaziba.net (Postfix) with ESMTP id 4CA9ACA783; Fri, 6 Nov 2015 11:04:38 +0100 (CET) X-Virus-Scanned: amavisd-new at mta10.int.yaziba.net Received: from mta10.int.yaziba.net ([127.0.0.1]) by localhost (mta10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0T-hjLJ0kkeQ; Fri, 6 Nov 2015 11:04:38 +0100 (CET) Received: from [10.0.48.76] (unknown [185.23.92.144]) by mta10.int.yaziba.net (Postfix) with ESMTPSA id 3704CCA781; Fri, 6 Nov 2015 11:04:38 +0100 (CET) To: "Soegtrop, Michael" , "caml-list@inria.fr" References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> From: Nicolas Ojeda Bar Message-ID: <563C7B37.60003@lexifi.com> Date: Fri, 6 Nov 2015 11:04:39 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-DRWEB-SCAN: ok X-VRSPAM-SCORE: -100 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: gggruggvucftvghtrhhoucdtuddrfeekhedrfeejgddtvdcutefuodetggdotefrucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpjgetkgfkueetnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtjegrtddtfeehnecuhfhrohhmpefpihgtohhlrghsucfqjhgvuggruceurghruceonhhitgholhgrshdrohhjvggurgdrsggrrheslhgvgihifhhirdgtohhmqeenucffohhmrghinhepihhnrhhirgdrfhhrpdhinhhtvghlrdguvgenucfrrghrrghmpehmohguvgepshhmthhpohhuth X-VRSPAM-EXTCAUSE: mhhouggvpehsmhhtphhouhht Subject: Re: [Caml-list] Newbie comment on constructor syntax Dear Michael, No, there is no such syntax. See http://caml.inria.fr/pub/ml-archives/caml-list/2001/08/47db53a4b42529708647c9e81183598b.en.html for more information. Kind regards, Nicolas On 11/6/2015 10:33 AM, Soegtrop, Michael wrote: > Dear Ocaml users, > > I just started to develop in OCaml, and must say it is smoother than expected. Although I did C/C++ for decades, I do less errors in Ocaml, both syntactically 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 can take only one argument - or a tuple. Although I know it is wrong, I always write "Constr a b" instead of "Constr (a, b)". I know syntax is only a minor thing and mostly a matter of taste, but a large fraction of my syntax errors in new code are of this kind (when modifying code it is a bit different). Somehow I think this doesn't go together well with the function call syntax 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 guess I want to use the usual function call syntax. > > My question: Is there some syntax to give a constructor more than one argument which escaped me? Something like if I leave away the * in the definition 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 nested 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 > >