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 53B8A7FA5E for ; Fri, 21 Apr 2017 18:43:58 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.131; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AXcLegBJqkMLsJAAH9NmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgRLvrxwZ3uMQTl6Ol3ixeRBMOAuq4C07KempujcFRI2YyGvnEGfc4EfD4+ou?= =?us-ascii?q?JSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgpp?= =?us-ascii?q?POT1HZPZg9iq2+yo9ZDeZwpFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+?= =?us-ascii?q?RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLd?= =?us-ascii?q?QgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QLYpUjqg8qhrUgflhj?= =?us-ascii?q?oZOT438G/ZicJ+g6xUrx2juxNxzJXZYJ2XOfdkYq/RYd0XSGhHU81MVyJBGIS8?= =?us-ascii?q?b44XAuQAI+lYtZTyrEYToxuiAgmsAPvvyjpSiX/w260xzuMsEQDA3AwuGNIDq3?= =?us-ascii?q?vUo8vvNKgPSOy117XIzTLHb/NO3Dfy8o7IchY7rf6RQ719aMzcwlQsGQPdllic?= =?us-ascii?q?t5HpMy2P2ugTrWSW7fBsWf+xh2MmsQ19vzaiyto0hoTKho8Z0E3I+CZ3zYovJN?= =?us-ascii?q?C1TFR3bcOlHZdNsSyRKpF4Tdk4Q25yvSY30r0GtoC/fCgN0Jknwhnfa+Gbc4SS?= =?us-ascii?q?4RLjSeCRLipmi3JjY7KwmQyy8Va+xe3mTMW7zUhFojJEktnKqH8NywTe5taaRv?= =?us-ascii?q?dj5EutxyiD2gLJ5u1ZP0w5lLDXJ4Mvz7ItjpYTtF7MHi7ymEX4lq+WcUAk9/Cp?= =?us-ascii?q?6+ThbLXmoYSRN4BqhQHkL6sig9e/Afg/MggKR2ib/P6z1Lvl/UHjXbpFkOU6kr?= =?us-ascii?q?PFv5DCOcQbuqm5DhdJ3Yk57ha/Cy6q0NAZnXkcMFJIYwmHjojsO1HWOv/0F/a/?= =?us-ascii?q?g1K2kDdq3f/KJLPhAo+eZkTExbzoeLI4709H1CIyy8pe7tRaEOIvOvX2D2D8rt?= =?us-ascii?q?CQNQM+NxSxyuDhQIF80I0ZcW2CGKPcK7/VtUeN7+QpZeWBMtxG8A3hIuQosqa9?= =?us-ascii?q?xUQynkUQKPGk?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0BSAABFNvpYhoN+49RcGwEBAQMBAQEJA?= =?us-ascii?q?QEBFgEBAQMBAQEJAQEBhRaDZ4oVkWgMlViCD4YkAoQLPxgBAQEBAQEBAQEBARI?= =?us-ascii?q?BAQEICwsIKC+CMyCCQwECAyMEETUcCxgCAiYCAlcTBgIBARCKDAGpX4FsOosiA?= =?us-ascii?q?QEIAiaBC4RVgnuCboddgl8FiTOGWIFSi2R5agOMDIctiFeGZ5QZH4E+QyEURIR?= =?us-ascii?q?pEAyBZXOJNgEBAQ?= X-IPAS-Result: =?us-ascii?q?A0BSAABFNvpYhoN+49RcGwEBAQMBAQEJAQEBFgEBAQMBAQE?= =?us-ascii?q?JAQEBhRaDZ4oVkWgMlViCD4YkAoQLPxgBAQEBAQEBAQEBARIBAQEICwsIKC+CM?= =?us-ascii?q?yCCQwECAyMEETUcCxgCAiYCAlcTBgIBARCKDAGpX4FsOosiAQEIAiaBC4RVgnu?= =?us-ascii?q?Cboddgl8FiTOGWIFSi2R5agOMDIctiFeGZ5QZH4E+QyEURIRpEAyBZXOJNgEBA?= =?us-ascii?q?Q?= X-IronPort-AV: E=Sophos;i="5.37,230,1488841200"; d="scan'208";a="221120349" Received: from mout.kundenserver.de ([212.227.126.131]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 21 Apr 2017 18:43:57 +0200 Received: from office1.lan.sumadev.de ([85.183.69.161]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.167]) with ESMTPSA (Nemesis) id 0M1eUE-1c8Gus1H2I-00tkpq for ; Fri, 21 Apr 2017 18:43:56 +0200 Received: from gerdbook.fritz.box (gerdbook.fritz.box [192.168.5.104]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 77323DC05D for ; Fri, 21 Apr 2017 18:43:55 +0200 (CEST) To: caml-list@inria.fr References: <58FA282A021A076200390603_0_57023@msllnjpmsgsv06> From: Gerd Stolpmann Message-ID: Date: Fri, 21 Apr 2017 18:43:55 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:vQc1IIP/ecMgva5fcmEmrd5FkpyFbJspKnpf2PKdt4Y9JSVMWJ0 Gglcm4b/bjeMAhj6Uz90JKODrJvro283aU+L6wViwpaWEA7EsIIlibspayrk+E5gMp+MhqZ LVxrUzFi8x5aw/cMyd4wevnXY9rV9xiQ5pE6dQ8IRfYSzm5Os+LtSVxgGldecB+V3xZFY6q 8uEUf7O8lAW78lWIfmPiw== X-UI-Out-Filterresults: notjunk:1;V01:K0:py4HnnSa3GI=:otEKPwNiWFYhsyrZxLybmt 4XvcrC03RkOp35NKHuCi86m3CDrX5NTCBUAFhbWEhFJIWyfB8grzhjaw8COoE142YcW/6xiT6 CFosCXkLTJq6QbnZO0g69wfcsS1DYjMfJkW2r3Q5VXiV5rrYhXSBtehwcW69NQE/17MZNZSAJ sr1N6+8AZRFfBYGEd8b8iTz97cZr86lW/Ynl0v2+E+OAUjrNOaH0Hlep14Ueb1C6ns6rn6j4g JUgUjdVRMEx1eFOtAGnpvcfPEkRjxLJB7HbNt2Lab0tqlx3zzjNl0KhRQj5M0VOzMwzfAbsz7 +42uT+AUNb2E574hIlJ/rz+F6NTm9da1VYY6wTo3O4dIAVDvOjbFBqqtb+CUJ71fw20DLj3PS wq1x+07+jg1SzR2BLc1uUv/UxLOJKxodETspmIQxh2OJk3SqGJZbFsQC0+WDb5Zm7drP73kBe 7byU5inQ1rHrWaE5OWX1zDXLzDddZYWCB2Id4UxGf5siJctg9rHBghAgW9ELtRluBfvMB2RzO 9ST0OjDfLLneDbemN27TlE5w9cuRsj6VZsaHsFMv7dq0O3JSr5eJ/hp3ftewSPk4niae42GnJ p8a1mjmexRBWb0oUIAwEKVpdK1ZNZT7u8fNxiFF1YOzhctYA9bp9QFEIwUuL6OTjofh1jXdbh Xl+mdH+MVFjCavfYwdIl2am3Wp2yPDXpBL6m2h2dGKO0ej6ABt/uN4+jX+ckTHmHWHhlXTGfR BJDxWD5Yf+L7GDP/ Subject: Re: [Caml-list] PPX is harmful to our community in the long term So far I understand, with "syntax" you really mean syntax-as-string. I think most often the AST changes by adding more fields or more AST nodes. Wouldn't the situation already improve a lot if we switched to record variants for the AST types? (Besides that the compiler would get way more readable.) New fields wouldn't be a big problem anymore because they are looked up by name and not by position. Gerd On 21.04.17 18:04, Yotam Barnoy wrote: > My 2 cents: I personally think we did PPX wrong. PPX should have used > the syntax as its starting point for full backwards compatibility. > Currently, the PPX cycle is > > OCaml: { syntax -> AST -> serialized AST } -> PPX: {serialized AST -> > AST -> PPX modification -> serialized AST} -> OCaml: {serialized AST > -> AST -> ... } > > Exposing the AST is the cause of the problem you mention. If instead, > every PPX extension had a particular OCaml compiler's syntax parser > and syntax printer integrated into it, and the PPX cycle was: > > PPX: { syntax -> AST -> PPX modification -> syntax } -> compiler: { > syntax -> AST -> ...} > > We would have far fewer issues with PPX plugins, since they would be > as backwards-compatible as the syntax. > > I think this mistake happened because everyone was trying to move away > from camlp4's complexity, and we didn't notice that the problem with > camlp4 wasn't the approach, but rather the fact that it wasn't making > use of the same code as the compiler and therefore required its own > heavy learning-curve and parallel maintenance to keep up with the > compiler. To be fair though, camlp4 came before the age of OCaml on > github, opam, and the associated easy code/library sharing. > > The only issue I can see with this idea of improving PPX is that the > PPX-generated syntax wouldn't have the original source locations. We'd > need an annotation that indicated the original source locations > (perhaps row and column offsets) when a PPX translated to modified > syntax and printed it out, so that the compiler's errors would have > proper locations relative to the original source. > > -Yotam > > > On Fri, Apr 21, 2017 at 11:41 AM, Hongbo Zhang (BLOOMBERG/ 731 LEX) > wrote: >> Dear OCaml developers: >> Given that bitten by PPX from time to time, finally, I think it is a time to >> spend two hours sharing my experience with PPX and why you(the OCaml library >> developer) should avoid PPX as much as you can. >> >> Here is a story I just experienced this morning, I tried to install a >> package from opam, and it complained my compiler is too old - 4.02.3, to be >> honest, 4.02.3 is still a pretty modern OCaml compiler, even debian stable >> still stays on 4.01. Anyway, I switched to 4.04.1, after half an hour, it >> failed to compile again, complaning about some ppx error message. This is >> not my first time experience, and finally it made me to write an essay about >> why PPX is harmful. >> PPX is a compiler plugin, it imposes a very large compiler surface API to >> your library, and we don't have any backward compatibility guarantee from >> the compiler, which means your library will only work against a specific >> compiler. Even worse, OCaml is an elegant but small community, we don't have >> too many maintainers for a library, if you have a library which relies on >> PPX (the dependency chain could be really really huge, for example, >> ppx_metaquot depends on typing environment, you can find lots of stories >> about node_modules in Node community), it will probably not work against >> next version of OCaml compiler, and it will be a huge maintenance overhead >> for other people to pick it up. >> >> OCaml is already a very expressive language, probably more expressive than >> any other mainstream language, (Go, Java, C/C++, etc), it is fine to write >> some boilerplate code, or we can cut PPX as a dev dependency, after your >> PPXed your code, check in the generated source code(via -dsource), so it >> will not bring dependency to end users. >> There are some valid use cases of PPX, for example, in BuckleScript or >> JS_of_OCaml, we want to customize OCaml language a bit for external FFI, or >> if you have a very large team, and committed effort to maintain your PPX. >> Happy hacking in OCaml without PPX, Thanks -- Hongbo >> >>