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 BD8857FD26 for ; Fri, 6 Nov 2015 10:33:42 +0100 (CET) IronPort-PHdr: 9a23:ZKx44BNptu8Sj1TOIW8l6mtUPXoX/o7sNwtQ0KIMzox0KPr8rarrMEGX3/hxlliBBdydsKIZzbKO+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStOU15z//tvx0qOQSj0AvCC6b7J2IUf+hiTqne5Sv7FfLL0swADCuHpCdrce72ppIVWOg0S0vZ/or9YwuxhX7rgq/stEFKH7ZLgQTLpCDT1gPXp/rJngvBzHCA+O/Wc0U2MMkxMODRKTvz/gWZKk+BD9u+Vhwi6CeYXTTLs0UDmmpe8/TR7jiC4KM3gi92zYltZ3lIpapg6so1p0xIuCM9LdD+Z3Yq6IJYBSfmFGRMsEDyE= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=michael.soegtrop@intel.com; spf=Pass smtp.mailfrom=michael.soegtrop@intel.com; spf=None smtp.helo=postmaster@mga02.intel.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of michael.soegtrop@intel.com) identity=pra; client-ip=134.134.136.20; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="michael.soegtrop@intel.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of michael.soegtrop@intel.com designates 134.134.136.20 as permitted sender) identity=mailfrom; client-ip=134.134.136.20; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="michael.soegtrop@intel.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mga02.intel.com) identity=helo; client-ip=134.134.136.20; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="postmaster@mga02.intel.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BfAAApczxWnBSIhoZehA5vBr4jgWAZhXcCgTY6EgEBAQEBAQEBEAEBAQEBBg0JCSEjC4IuggkFOg9CASoUQiYBBBuIJQGgQKEWhlaEfIRbg0mBFQWWSAF7jgOHZZMEKAeCRRYHgVZyhA0BgQYBAQE X-IPAS-Result: A0BfAAApczxWnBSIhoZehA5vBr4jgWAZhXcCgTY6EgEBAQEBAQEBEAEBAQEBBg0JCSEjC4IuggkFOg9CASoUQiYBBBuIJQGgQKEWhlaEfIRbg0mBFQWWSAF7jgOHZZMEKAeCRRYHgVZyhA0BgQYBAQE X-IronPort-AV: E=Sophos;i="5.20,251,1444687200"; d="scan'208";a="152882268" Received: from mga02.intel.com ([134.134.136.20]) by mail3-smtp-sop.national.inria.fr with ESMTP; 06 Nov 2015 10:33:40 +0100 Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 06 Nov 2015 01:33:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,251,1444719600"; d="scan'208";a="595107065" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by FMSMGA003.fm.intel.com with ESMTP; 06 Nov 2015 01:33:38 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.251]) by irsmsx110.ger.corp.intel.com ([169.254.15.151]) with mapi id 14.03.0248.002; Fri, 6 Nov 2015 09:33:04 +0000 From: "Soegtrop, Michael" To: "caml-list@inria.fr" Thread-Topic: Newbie comment on constructor syntax Thread-Index: AdEYdh7tbwUSNAYOTYyfd0AlZw/waQ== Date: Fri, 6 Nov 2015 09:33:04 +0000 Message-ID: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: [Caml-list] Newbie comment on constructor syntax Dear Ocaml users, I just started to develop in OCaml, and must say it is smoother than expect= ed. Although I did C/C++ for decades, I do less errors in Ocaml, both synta= ctically and in terms of if programs behave as expected. It appears to be m= uch closer to human thinking than C/C++ and I already wonder how I could li= ve 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 mino= r thing and mostly a matter of taste, but a large fraction of my syntax err= ors 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 syn= tax of OCaml. I guess deep in my brain a constructor is a function which ta= kes 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 argum= ent which escaped me? Something like if I leave away the * in the definitio= n 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 neste= d constructs. Does everybody use camlp4/p5/ppx to customize the syntax to h= is liking (as chapter 5 of the camlp4 manual suggests)? Or are there some l= ong 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