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 A5AC97EEFA for ; Mon, 9 Nov 2015 11:00:41 +0100 (CET) IronPort-PHdr: 9a23:RNVDJRPkUS8MLTuIkyQl6mtUPXoX/o7sNwtQ0KIMzox0KP/yrarrMEGX3/hxlliBBdydsKIZzbaN+Pi5EUU7or+/81k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ35nxi7v5o8SbSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/JHBK7zeqB9Sb1DEBwnNXo07Yvlr0rtVwyKs1sRVGkMkxkAKQ/C6VmuXpr3vjH7tcJh3zGdPIvuSrctHz+l6vE4G1fTlC4bOmthoynsgctqgfcDrQ== Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=hendrik@topoi.pooq.com; spf=None smtp.mailfrom=hendrik@topoi.pooq.com; spf=None smtp.helo=postmaster@april.topoi.pooq.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of hendrik@topoi.pooq.com) identity=pra; client-ip=69.165.131.134; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="hendrik@topoi.pooq.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of hendrik@topoi.pooq.com) identity=mailfrom; client-ip=69.165.131.134; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="hendrik@topoi.pooq.com"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@april.topoi.pooq.com) identity=helo; client-ip=69.165.131.134; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="hendrik@topoi.pooq.com"; x-sender="postmaster@april.topoi.pooq.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CGCAB0bkBW/4aDpUVehFcBwE2GEAKBbRABAQEBAQEBAYEJgi6CCAEBBDpPCxgJJQ8FGIhyvz0BAQgCIYtShSeCfYEVBY4RiDeNHwhdm2g4K4QiIIYaAQEB X-IPAS-Result: A0CGCAB0bkBW/4aDpUVehFcBwE2GEAKBbRABAQEBAQEBAYEJgi6CCAEBBDpPCxgJJQ8FGIhyvz0BAQgCIYtShSeCfYEVBY4RiDeNHwhdm2g4K4QiIIYaAQEB X-IronPort-AV: E=Sophos;i="5.20,265,1444687200"; d="scan'208";a="186706195" Received: from topoi.pooq.com (HELO april.topoi.pooq.com) ([69.165.131.134]) by mail2-smtp-roc.national.inria.fr with ESMTP; 09 Nov 2015 11:00:31 +0100 Received: by april.topoi.pooq.com (Postfix, from userid 1001) id CB2FA1A0624; Mon, 9 Nov 2015 05:00:28 -0500 (EST) Date: Mon, 9 Nov 2015 05:00:28 -0500 From: Hendrik Boom To: caml-list@inria.fr Message-ID: <20151109100028.GA12879@topoi.pooq.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> <87pozk6vjp.fsf@mid.deneb.enyo.de> <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E747@IRSMSX102.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E747@IRSMSX102.ger.corp.intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) Subject: Re: [Caml-list] Newbie comment on constructor syntax On Mon, Nov 09, 2015 at 08:09:30AM +0000, Soegtrop, Michael wrote: > Dear Florian, Norman, > > > > Curiously, the argument is not really a tuple. This does not work: > > > > > > type x = X of int * int > > > let c = (1, 2) in X c > > > > However the following works: > > # type x = X of (int * int);; > > type x = X of (int * int) > > # let c = (1, 2) in X c;; > > - : x = X (1, 2) > > Exactly this is what is quite confusing (for the beginner): constructors are a rather odd mix of multiple arguments and tuples. The notation looks like tuples, both in definition and use, but it isn't. And it is not a multiple argument function either, since currying doesn't work. That adding parenthesis makes it a real tuple doesn't make it better, since at some other places a*b and (a*b) are the same. > > To me this is quite a scar in the beauty of the language - the kind of thing you can't avoid to look at, if you know what I mean. Of cause it is not really an issue. It is just way disappointing for new users to find this kind of imperfection and it gives a little dent in the enthusiasm. But just a little one ;-) Parentheses should never be used with a meaning other than indicating proper grouping, their original function in high school algebra. OCaml went partway there by abolishing them as syntax for function calls. -- hendrik