From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 902057EEB9 for ; Mon, 26 Oct 2015 16:31:21 +0100 (CET) IronPort-PHdr: 9a23:hEY60hfHeej28QrYPdc33tUSlGMj4u6mDksu8pMizoh2WeGdxc+6YR7h7PlgxGXEQZ/co6odzbGG7ua5ACdfvN6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDvvcSKKFoVzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IeezAcq85Vb1VCig9eyBwvZWz9Er1dhaU/nYXTkkRlxNJBUCFsEC7Dd/NtX7au+xxwiiZdefxSrV8DTSv6atxSRzAlCAfMD9/6GbQk4p7i6cN8zy7oBkq7IfeeoCYMLJFdaPQZ94ADT5OV8xLViFFRJi3b4YVAvApMuNRro27rFwL+0jtTTKwDf/in2cbzkT92rc3hqF8SAw= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gabriel.scherer@gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer@gmail.com; spf=None smtp.helo=postmaster@mail-ig0-f181.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.213.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.213.181 as permitted sender) identity=mailfrom; client-ip=209.85.213.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.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@mail-ig0-f181.google.com) identity=helo; client-ip=209.85.213.181; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-ig0-f181.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0DWAAD7Ri5WlbXVVdFehApvBqx6hSuMKIFaFwEJhXwCgSoHOhIBAQEBAQEBARABAQEBBw0JCR8wgiuCBwEBAQMBEhEdARsSCwEDAQsGBQsNDR0CAiIBEQEFAQoSBhMSEId4AQMKCA2kXIExPjGLSYFsgnmIBAoZJwMKVoQAAQEBAQEFAQEBAQEBAQEVAQUOhmmEfoUJBAeCLjsUgTEFhgkMkCGFHIgGgVlIlh6CJBIjgRcRFwiCNyOBXT00hxgBAQE X-IPAS-Result: A0DWAAD7Ri5WlbXVVdFehApvBqx6hSuMKIFaFwEJhXwCgSoHOhIBAQEBAQEBARABAQEBBw0JCR8wgiuCBwEBAQMBEhEdARsSCwEDAQsGBQsNDR0CAiIBEQEFAQoSBhMSEId4AQMKCA2kXIExPjGLSYFsgnmIBAoZJwMKVoQAAQEBAQEFAQEBAQEBAQEVAQUOhmmEfoUJBAeCLjsUgTEFhgkMkCGFHIgGgVlIlh6CJBIjgRcRFwiCNyOBXT00hxgBAQE X-IronPort-AV: E=Sophos;i="5.20,201,1444687200"; d="scan'208";a="151788835" Received: from mail-ig0-f181.google.com ([209.85.213.181]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 26 Oct 2015 16:31:20 +0100 Received: by igbkq10 with SMTP id kq10so75408055igb.0 for ; Mon, 26 Oct 2015 08:31:19 -0700 (PDT) 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=zPlcvZn+cBp7ELvKH70Qz1kj2zbrUhHAqTsdewErP44=; b=eR/Kg3+W4uY9Kdn2uZIYLIPxe4cFJInCYMksI0e/IO9JtZ6sjqhzwXoPZF9dC2FSZw 5tAmsqRrfjGBX3AggHN3lFl1+BnWz6Gwpz8ZXHYXUsqPv1qVMlsobYL2oiqHuqGDQf+a 6M0JtG4sStYa2I0H4oLUPyqqFX2i8mJ5XAz5lTs1L+KgiJroZrm4ju7wHxp/6ePtrorL xFWIdNVNyRpl6h4PaWAKI/kPz2FYJrh2RPE3i0c+UPjrUJgpVMj9HgNLm3AsfSbmBS3/ TzvqcGMvVJx8ERbPFRYM9bO5wI/zFcQcgo+suzAHsKUI+HAHDK021Kv1jCIbVtCQzDfb yZpw== X-Received: by 10.50.13.72 with SMTP id f8mr7007049igc.38.1445873479153; Mon, 26 Oct 2015 08:31:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.79.39.78 with HTTP; Mon, 26 Oct 2015 08:30:39 -0700 (PDT) In-Reply-To: <20151026151809.GA23211@topoi.pooq.com> References: <0F7D3B1B3C4B894D824F5B822E3E5A172CE337FB@IRSMSX102.ger.corp.intel.com> <20151026142114.GA4803@topoi.pooq.com> <20151026151809.GA23211@topoi.pooq.com> From: Gabriel Scherer Date: Mon, 26 Oct 2015 16:30:39 +0100 Message-ID: To: Hendrik Boom Cc: caml users Content-Type: multipart/alternative; boundary=089e013c65de1da11f052303a7be Subject: Re: [Caml-list] Is this the right place to discuss camlp5? --089e013c65de1da11f052303a7be Content-Type: text/plain; charset=UTF-8 To my knowledge, nobody has contributed parsing of attributes and extensions (a change to the OCaml syntax whose use is central to many of the ppx extensions) to camlp4 or camlp5 (which implement their own OCaml parsers and thus need to be updated accordingly). It would not necessarily be too difficult to do so, but that means that currently you cannot combine camlp{4,5} and PPX extensions within the same source file. There is another way to understand your question: if you have developed camlp{4,5} extensions, how hard is it to port them to ppx, or conversely to port a ppx extension to camlp{4,5}? My answer would be "rather easy", knowing that there are two separate aspects: - The first thing an extension does is to parse some part of the user input to recognize extension-specific code. This is relatively easy to do using both systems, but done in a completely different ways, so this part (the "frontend") of the extension needs to be completely rewritten. In addition, ppx is more restricted than camlp{4,5} in terms of the flexibility to change the syntax (this is a feature), so some things that are easy to do for camlp{4,5} extensions may require some thoughts about how to express this with extensions/attributes instead. - Once the extension has recognized the information it relies on within the user source code, it will do some extension-specific stuff and spit some AST out. This is very easy to port from one extension to the other, and most of this part of the code (the "backend") can be reused. The respective size of frontend and backend differs depending on the extension. The more complex the frontend part, the harder the transition from one system to another (this also applies to porting an extension from camlp4 to camlp5 or vice-versa). On Mon, Oct 26, 2015 at 4:18 PM, Hendrik Boom wrote: > On Mon, Oct 26, 2015 at 02:27:23PM +0000, David Allsopp wrote: > > Hendrik Boom wrote: > > > On Mon, Oct 26, 2015 at 01:35:45PM +0000, Soegtrop, Michael wrote: > > > > Dear Ocaml Users, > > > > > > > > I just wanted to ask, if this is the right place to discuss camlp5, > or > > > if there is a better place. I have a rather bizarre build issue on > Cygwin > > > and a fix (well a hack) for it. > > > > > > Now I've heard about campl5, presumably a successor to campl4, and > about > > > ppx, touted as a successor to camlp4. > > > > In fact, camlp5 is technically the predecessor of camlp4! camlp4 was > incompatibly re-worked for OCaml 3.10 (I think it was 3.10, anyway) - > Daniel De Rauglaudre, the author of the original camlp4 but at that time > not its maintainer, decided to continue development of the original camlp4 > but, to avoid creating even more hell in the upgrade to OCaml 3.10, renamed > the tool to camlp5. So camlp5 is basically a maintained fork of an older > version of camlp4. > > > > ppx is a much more recent innovation designed to replace most uses of > both those tools. Which is at least part of the reason that camlp4 is no > longer included in mainline OCaml. > > > > > What gives here? > > > > History! And also that converting between camlp4/camlp5/ppx is > non-trivial. If doing something new, and you don't need to worry about > older OCamls, ppx is the way to go... > > How incomptible are they? I don't expect to be able to use ppx in > the place of camlp4 on camlp4 code, but is there any difficulty > combining legacy code written using camlp4 with new code written > using ppx? > > -- hendrik > > -- > 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 > --089e013c65de1da11f052303a7be Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
To my knowledge, nobody has contribute= d parsing of attributes and extensions (a change to the OCaml syntax whose = use is central to many of the ppx extensions) to camlp4 or camlp5 (which im= plement their own OCaml parsers and thus need to be updated accordingly). I= t would not necessarily be too difficult to do so, but that means that curr= ently you cannot combine camlp{4,5} and PPX extensions within the same sour= ce file.

There is another way to understand your question: if = you have developed camlp{4,5} extensions, how hard is it to port them to pp= x, or conversely to port a ppx extension to camlp{4,5}? My answer would be = "rather easy", knowing that there are two separate aspects:

- The first thing an extension does is to parse some part of the us= er input to recognize extension-specific code. This is relatively easy to d= o using both systems, but done in a completely different ways, so this part= (the "frontend") of the extension needs to be completely rewritt= en. In addition, ppx is more restricted than camlp{4,5} in terms of the fle= xibility to change the syntax (this is a feature), so some things that are = easy to do for camlp{4,5} extensions may require some thoughts about how to= express this with extensions/attributes instead.

- Once the e= xtension has recognized the information it relies on within the user source= code, it will do some extension-specific stuff and spit some AST out. This= is very easy to port from one extension to the other, and most of this par= t of the code (the "backend") can be reused.

The res= pective size of frontend and backend differs depending on the extension. Th= e more complex the frontend part, the harder the transition from one system= to another (this also applies to porting an extension from camlp4 to camlp= 5 or vice-versa).


On Mon, Oct 26, 2015 at 4:1= 8 PM, Hendrik Boom <hendrik@topoi.pooq.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">On Mon, Oct 26, 2015 at 02:2= 7:23PM +0000, David Allsopp wrote:
> Hendrik Boom wrote:
> > On Mon, Oct 26, 2015 at 01:35:45PM +0000, Soegtrop, Michael wrote= :
> > > Dear Ocaml Users,
> > >
> > > I just wanted to ask, if this is the right place to discuss = camlp5, or
> > if there is a better place. I have a rather bizarre build issue o= n Cygwin
> > and a fix (well a hack) for it.
> >
> > Now I've heard about campl5, presumably a successor to campl4= , and about
> > ppx, touted as a successor to camlp4.
>
> In fact, camlp5 is technically the predecessor of camlp4! camlp4 was i= ncompatibly re-worked for OCaml 3.10 (I think it was 3.10, anyway) - Daniel= De Rauglaudre, the author of the original camlp4 but at that time not its = maintainer, decided to continue development of the original camlp4 but, to = avoid creating even more hell in the upgrade to OCaml 3.10, renamed the too= l to camlp5. So camlp5 is basically a maintained fork of an older version o= f camlp4.
>
> ppx is a much more recent innovation designed to replace most uses of = both those tools. Which is at least part of the reason that camlp4 is no lo= nger included in mainline OCaml.
>
> > What gives here?
>
> History! And also that converting between camlp4/camlp5/ppx is non-tri= vial. If doing something new, and you don't need to worry about older O= Camls, ppx is the way to go...

How incomptible are they?=C2=A0 I don't expect to be able to use= ppx in
the place of camlp4 on camlp4 code, but is there any difficulty
combining legacy code written using camlp4 with new code written
using ppx?

-- hendrik

--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocam= l_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--089e013c65de1da11f052303a7be--