From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id pBBIE62Q021328 for ; Sun, 11 Dec 2011 19:14:06 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag0FAIHy5E7VuiYS/2dsb2JhbABDhDdQoyqCQIEFgXIBAQUMFwRSEAkCGgImAgIsKwaIHaMukE4UgSCJI4EWBKcZ X-IronPort-AV: E=Sophos;i="4.71,335,1320620400"; d="scan'208";a="134921842" Received: from solaria.dimino.org ([213.186.38.18]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 11 Dec 2011 19:14:01 +0100 Received: from aurora (localhost.localdomain [127.0.0.1]) by solaria.dimino.org (Postfix) with ESMTP id 1B78680088; Sun, 11 Dec 2011 19:14:01 +0100 (CET) Received: by aurora (Postfix, from userid 1000) id 270E241B11; Sun, 11 Dec 2011 19:14:07 +0100 (CET) Message-ID: <1323627246.32136.34.camel@aurora> From: =?ISO-8859-1?Q?J=E9r=E9mie?= Dimino To: Gabriel Scherer Cc: Wojciech Meyer , caml users Date: Sun, 11 Dec 2011 19:14:06 +0100 In-Reply-To: References: <55531934-37A5-4CC5-AB67-20CE4CCE8269@googlemail.com> <4EE37070.4010702@inria.fr> <1323541702.32136.8.camel@aurora> <1323550544.32136.19.camel@aurora> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.0.3-3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id pBBIE62Q021328 Subject: Re: [Caml-list] Camlp4/p5 type reflection [ Le dimanche 11 décembre 2011 à 12:19 +0100, Gabriel Scherer a écrit : > If we had no Camlp4, we should push for some of these things to be > integrated in the language. > A reasonable but solid mixfix syntax could replace pa_monad, the > "##"-syntax of pa_js, and some aspects of pa_lwt. > "jsnew" and list comprehensions could perfectly be handled as quotations. I don't think it is possible to do pa_lwt via mixfix syntax. For example pa_lwt does this kind of transformation: lwt x = f () and y = g () and z = h () in return (x + y + z) --> let t1 = f () and t2 = g () and t3 = h () in Lwt.bind t1 (fun x -> Lwt.bind t2 (fun y -> Lwt.bind t3 (fun z -> return (x + y + z)))) The first form is much more readable. And it has another big advantage: it adds backtrace support. Because as soon as you use monads in ocaml, backtraces are unusable. And you just can't seriously ask the user to write that kind of code: Lwt.fail (try raise End_of_file with exn -> exn) So unless we have better support for monads in OCaml itself, i think Camlp4 is still required. That said, i am not either a big fan of extending the syntax since it makes code harder to understand for those who don't know the extensions. -- Jérémie