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 716CC7FD27 for ; Fri, 6 Nov 2015 15:10:49 +0100 (CET) IronPort-PHdr: 9a23:JeWY5hxvKeLmAl/XCy+O+j09IxM/srCxBDY+r6Qd0eIQIJqq85mqBkHD//Il1AaPBtWGraocw8Pt8IneGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2WVTerzWI4CIIHV2nbEwudrmzQtaapv/0/t7x0qWbWx9Piju5bOE6BzSNhiKViPMrh5B/IL060BrDrygAUe1XwWR1OQDbxE6ktY+YtaRu+CVIuv8n69UIEeCjJ/x5HvRkC2FsCGc469HxsgGHBS6O7XsVX2Fc2k5NAgPF5Rz+GIz2vyTmrO1l8CicIcDyC7szXGLxwb1sTUrBkycGLD5x2W7ekNN5iOoPqR2ovQN2x9eFP9y9O/93f6ebdtQfEzkSFv1NXjBMV9vvJ7AECPAMaKMB99Hw Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=agarwal1975@gmail.com; spf=Pass smtp.mailfrom=agarwal1975@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f47.google.com Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of agarwal1975@gmail.com) identity=pra; client-ip=74.125.82.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of agarwal1975@gmail.com designates 74.125.82.47 as permitted sender) identity=mailfrom; client-ip=74.125.82.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.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-wm0-f47.google.com) identity=helo; client-ip=74.125.82.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="postmaster@mail-wm0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AEAQAYtDxWlC9SfUpegm6BIG8GhA+vd4wIIYVvAoEtBzsRAQEBAQEBAQEQAQEBAQcLCwkfMIIuggcBAQEDARIRBBkBCBMdAQMBCwYDAgsGBAEBKAMCAiIBEQEFAQsJCAYTFA6HdgEDCggNkziPTYExPjGLSIFqgnmGewoZJw1Wg2gBAQEBAQEBAQEBAQEBAQEBAQEBAQESAQUOij6BBoUICYJkgUQFjhGIMAeFHYgIgVtJli6CJRIkgRcRJoIwI4F7IDSFFAEBAQ X-IPAS-Result: A0AEAQAYtDxWlC9SfUpegm6BIG8GhA+vd4wIIYVvAoEtBzsRAQEBAQEBAQEQAQEBAQcLCwkfMIIuggcBAQEDARIRBBkBCBMdAQMBCwYDAgsGBAEBKAMCAiIBEQEFAQsJCAYTFA6HdgEDCggNkziPTYExPjGLSIFqgnmGewoZJw1Wg2gBAQEBAQEBAQEBAQEBAQEBAQEBAQESAQUOij6BBoUICYJkgUQFjhGIMAeFHYgIgVtJli6CJRIkgRcRJoIwI4F7IDSFFAEBAQ X-IronPort-AV: E=Sophos;i="5.20,252,1444687200"; d="scan'208";a="186409909" Received: from mail-wm0-f47.google.com ([74.125.82.47]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 06 Nov 2015 15:10:48 +0100 Received: by wmll128 with SMTP id l128so41840427wml.0 for ; Fri, 06 Nov 2015 06:10:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9UDOenGeSbBT9uI/xuN2oYV00G+iig6Vx8YsIoflifc=; b=GlureVymeL1cQVSg1sV5yxDbG3E7BshpfB991/hB7PDM4QcK3cf2jOE+XorpwSFoe2 3n2yIQYpBNXxZzJA8uSRAompZE1Cl4h6fYJVnSXUueExHL+BG9z+MZNki9kIeLdcizo0 pvnawafvCHT/V57k6Xij4FkIBUrxuHSRw+l7WkizEgE8SboqM0aujr1e16+VPv6XAnSE cWD0uiBduAt3RR+V/rpV7DMPlYIidfw8BZXJSWVMv0GSv14Ib5xNd8DY2o4u2a0zYduG 1es8JwKhncZrUe1bQy1dX974cjOOv3Ufsv3WvmYZCliK1pSLRK0IJEkSk6vT7r2H/iVn 4AZQ== X-Received: by 10.28.138.140 with SMTP id m134mr10361303wmd.74.1446819048222; Fri, 06 Nov 2015 06:10:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.27.82.65 with HTTP; Fri, 6 Nov 2015 06:10:28 -0800 (PST) In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E156@IRSMSX102.ger.corp.intel.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E070@IRSMSX102.ger.corp.intel.com> <563C816B.7020604@inria.fr> <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E0E1@IRSMSX102.ger.corp.intel.com> <0F7D3B1B3C4B894D824F5B822E3E5A172CE3E156@IRSMSX102.ger.corp.intel.com> From: Ashish Agarwal Date: Fri, 6 Nov 2015 09:10:28 -0500 Message-ID: To: "Soegtrop, Michael" Cc: Gabriel Scherer , "caml-list@inria.fr" Content-Type: multipart/alternative; boundary=001a114436026c79770523dfcf26 Subject: Re: [Caml-list] Newbie comment on constructor syntax --001a114436026c79770523dfcf26 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable You might be interested in: https://github.com/janestreet/ppx_variants_conv Example: $ utop utop # #require "ppx_deriving";; utop # #require "ppx_variants_conv";; utop # #require "variantslib";; type t =3D A of int | C of int * int [@@deriving variants];; type t =3D A of int | C of int * int val c : int -> int -> t =3D val a : int -> t =3D module Variants : sig val c : (int -> int -> t) Variantslib.Variant.t val a : (int -> t) Variantslib.Variant.t val fold : init:'a -> a:('a -> (int -> t) Variantslib.Variant.t -> 'b) -> c:('b -> (int -> int -> t) Variantslib.Variant.t -> 'c) -> 'c val iter : a:((int -> t) Variantslib.Variant.t -> 'a) -> c:((int -> int -> t) Variantslib.Variant.t -> 'b) -> 'b val map : t -> a:((int -> t) Variantslib.Variant.t -> int -> 'a) -> c:((int -> int -> t) Variantslib.Variant.t -> int -> int -> 'a) -> 'a val descriptions : (string * int) list end (I'm not quite sure why you have to do three #require statements manually. Related to this .) > Does everybody use camlp4/p5/ppx to customize the syntax to his liking Note that the community is moving to ppx based syntax extensions, and away from camlp4/5. > 200k of code Where do you see that much code? I only see 6000 lines of code. On Fri, Nov 6, 2015 at 8:09 AM, Soegtrop, Michael < michael.soegtrop@intel.com> wrote: > Dear Gabriel, > > > > thanks for the link, an interesting idea and discussion! And I see that > maybe I should come over to Paris to participate ;-) I would agree with > Alain Frisch=E2=80=99s final comment that whenever a pattern synonym is u= sed in the > RHS, there should be an explicit binder. This would either solve the > =E2=80=9Ctrouble=E2=80=9D case or make the similarity to (x, x) obvious. > > > > Best regards, > > > > Michael > > > > *From:* caml-list-request@inria.fr [mailto:caml-list-request@inria.fr] *On > Behalf Of *Gabriel Scherer > *Sent:* Friday, November 06, 2015 1:34 PM > *To:* Soegtrop, Michael > *Cc:* Francois Berenger; caml-list@inria.fr > *Subject:* Re: [Caml-list] Newbie comment on constructor syntax > > > > The use of camlp{4,5} to change OCaml syntax has always had extremely low > adoption, with some very specific exceptions (notably the lwt-support > syntax of the Ocsigen project). I suspect that this is due to the fact th= at > integrating a new syntax extension to your project has historically caused > more build-system and deployment trouble than people were willing to > tolerate. > > ppx extensions are not designed to allow extending the OCaml syntax, and > in particular I think they are not a good fit for what you are looking fo= r. > It is a large part of their appeal: by being less flexible, they are > simpler and more robust. > > I personally believe that currified constructor syntax would be a better > choice, and that using non-currified constructors is a historical mistake > of SML/Caml. But I am also not convinced that efforts to change it today > are worth the trouble, and prefer to concentrate on improving other parts > of the OCaml ecosystem. > > Another thing that was touched by your comments is the usefulness of > user-defined patterns (pattern synonyms). I have conflicted opinions on t= he > question of whether adding pattern synonyms would be a good thing, but > described one aspect of a proposal that I like (but also highlights that > the feature can be a source of implementation complexity) in > http://gallium.inria.fr/blog/pattern-synonyms-as-expressions/ > > 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 > --001a114436026c79770523dfcf26 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
You might be interested in:

Example:

$= utop
utop # #require "ppx_deriving";;
ut= op # #require "ppx_variants_conv";;
utop # #require= "variantslib";;

type t =3D A o= f int | C of int * int [@@deriving variants];;
type t =3D A of in= t | C of int * int
val c : int -> int -> t =3D <fun><= /div>
val a : int -> t =3D <fun> =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0
module Variants :
=C2=A0 sig
=C2=A0 =C2=A0 val c : (int -> int -> t) Variantslib.Variant.t
=
=C2=A0 =C2=A0 val a : (int -> t) Variantslib.Variant.t
= =C2=A0 =C2=A0 val fold :
=C2=A0 =C2=A0 =C2=A0 init:'a ->
=C2=A0 =C2=A0 =C2=A0 a:('a -> (int -> t) Variantslib.Var= iant.t -> 'b) ->
=C2=A0 =C2=A0 =C2=A0 c:('b -> (= int -> int -> t) Variantslib.Variant.t -> 'c) -> 'c
=C2=A0 =C2=A0 val iter :
=C2=A0 =C2=A0 =C2=A0 a:((int ->= ; t) Variantslib.Variant.t -> 'a) ->
=C2=A0 =C2=A0 =C2= =A0 c:((int -> int -> t) Variantslib.Variant.t -> 'b) -> &#= 39;b
=C2=A0 =C2=A0 val map :
=C2=A0 =C2=A0 =C2=A0 t -&g= t;
=C2=A0 =C2=A0 =C2=A0 a:((int -> t) Variantslib.Variant.t -&= gt; int -> 'a) ->
=C2=A0 =C2=A0 =C2=A0 c:((int -> in= t -> t) Variantslib.Variant.t -> int -> int -> 'a) -> &#= 39;a
=C2=A0 =C2=A0 val descriptions : (string * int) list
=C2=A0 end

(I'm not quite sure why yo= u have to do three #require statements manually. Related to=C2=A0this.)


>=C2=A0D= oes everybody use camlp4/p5/ppx to customize the syntax to his liking

Note that the community is moving to ppx based syn= tax extensions, and away from camlp4/5.

>= =C2=A0200k of code

Where do you see that much code? I only see 6000 lines of cod= e.

=

O= n Fri, Nov 6, 2015 at 8:09 AM, Soegtrop, Michael <michael.soegtro= p@intel.com> wrote:

Dear Gabriel,

=C2=A0

thanks for the link, an i= nteresting idea and discussion! And I see that maybe I should come over to = Paris to participate ;-) I would agree with Alain Frisch=E2=80=99s final comment that whenever a pattern synonym is used in the RHS, there sh= ould be an explicit binder. This would either solve the =E2=80=9Ctrouble=E2= =80=9D case or make the similarity to (x, x) obvious.<= /p>

=C2=A0

Best regards,

=C2=A0

Michael

=C2=A0

From: caml-list-request@= inria.fr [mailto:caml-list-request@inria.fr] On Behalf Of Gabriel Scherer
Sent: Friday, November 06, 2015 1:34 PM
To: Soegtrop, Michael
Cc: Francois Berenger; caml-list@inria.fr
Subject: Re: [Caml-list] Newbie comment on constructor syntax=

=C2=A0

The use of camlp{4,5}= to change OCaml syntax has always had extremely low adoption, with some ve= ry specific exceptions (notably the lwt-support syntax of the Ocsigen proje= ct). I suspect that this is due to the fact that integrating a new syntax extension to your project has historica= lly caused more build-system and deployment trouble than people were willin= g to tolerate.

ppx extensions are no= t designed to allow extending the OCaml syntax, and in particular I think t= hey are not a good fit for what you are looking for. It is a large part of = their appeal: by being less flexible, they are simpler and more robust.

I personally believe = that currified constructor syntax would be a better choice, and that using = non-currified constructors is a historical mistake of SML/Caml. But I am al= so not convinced that efforts to change it today are worth the trouble, and prefer to concentrate on improving oth= er parts of the OCaml ecosystem.

Another thing that was touched by your comments is t= he usefulness of user-defined patterns (pattern synonyms). I have conflicte= d opinions on the question of whether adding pattern synonyms would be a go= od thing, but described one aspect of a proposal that I like (but also highlights that the feature can be a s= ource of implementation complexity) in
=C2=A0 http://gallium.inria.fr/blog/pattern-synonyms-as-ex= pressions/

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, ww= w.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


--001a114436026c79770523dfcf26--