From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.4 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 45DDCBBC1 for ; Wed, 9 Apr 2008 09:52:08 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.25,627,1199660400"; d="asc'?scan'208";a="11246228" Received: from peray.inria.fr (HELO ausone.inria.fr) ([128.93.8.98]) by mail3-relais-sop.national.inria.fr with SMTP; 09 Apr 2008 09:52:08 +0200 Received: by ausone.inria.fr (sSMTP sendmail emulation); Wed, _d Apr 2008 09:52:05 +0200 From: "Nicolas Pouillard" Cc: Caml_mailing list Subject: Re: [Caml-list] weird behavior with camlp4o To: xclerc References: <1207726165.47fc70555cb83@imp.ovh.net> <95513600804090036m1bf04367w5736f67f3f37135b@mail.gmail.com> <1207727302.47fc74c6b621d@imp.ovh.net> In-Reply-To: <1207727302.47fc74c6b621d@imp.ovh.net> Date: Wed, 09 Apr 2008 09:52:05 +0200 Message-Id: <1207727460-sup-1852@port-ext16.ensta.fr> User-Agent: Sup/git Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=-1207727525-810746-59991-4328-8-="; micalg="pgp-sha1" MIME-Version: 1.0 X-Spam: no; 0.00; camlp:01 andrieu:01 oandrieu:01 ocaml:01 camlp:01 cmo:01 cmo:01 denotes:01 ocamlc:01 ocamlopt:01 -pp:01 compiler:01 compiler:01 wrote:01 abstract:01 X-Attachments: cset="UTF-8" type="application/pgp-signature" name="signature.asc" name="signature.asc" --=-1207727525-810746-59991-4328-8-= Content-Type: text/plain; charset=UTF-8 Excerpts from xclerc's message of Wed Apr 09 09:48:22 +0200 2008: > Selon Olivier Andrieu : > > > On Wed, Apr 9, 2008 at 9:29 AM, wrote: > > > Selon "Andrew I. Schein" : > > > > Greetings list - > > > > > > > > I was playing around with OCaml 3.10.2 camlp4o like this: > > > > > > > > camlp4o pa_breakcont.cmo sample1.ml > > > > > > > > with my macro pa_breakcont.cmo and got the expected macro translation > > > > printed to my terminal. However, when I type: > > > > > > > > camlp4o pa_breakcont.cmo sample1.ml > out.ml > > > > > > > > out.ml contains binary output. Am I misusing camlp4o? > > > > > > I have encountered the same problem a few days ago while working on > > > Ocaml-Java to make it camlp4-compatible. > > > > > > The fact is that the kind of output (binary dump of abstract tree or > > > source code in textual form) is chosen according to the nature of the > > > output file descriptor. If the output file descriptor denotes a tty > > > then the textual form is chosen, otherwise the binary form is chosen. > > > > > > That being said, I don't know what is the rationale of this choice, > > > as I have not come up with a use case for the binary form. > > > > It's simply more efficient for ocamlc or ocamlopt when camlp4 is > > called via the -pp option: no need to pretty-print and then reparse > > the source. > > Well, this is what I thought at first but, if I am not mistaken, when > you use the '-pp' option of a compiler, a command of the following form > is executed: "camlp4XXX source-file.ml > tmp-file.ml". > Then the "tmp-file.ml" is actually compiled instead of the "source-file.ml". > > So, it seems that compilers go through the textual form. Nop, the compiler knows both binary and textual formats. -- Nicolas Pouillard aka Ertai --=-1207727525-810746-59991-4328-8-= Content-Disposition: attachment; filename="signature.asc" Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (Darwin) iEYEARECAAYFAkf8daUACgkQj+FCNw9dwLkQdQCfbTd4Wr6s0Je0Ogvl1oBoyevW 4egAn3rVIEd7kBCVfJRrPndxQVgp8XaD =jMHD -----END PGP SIGNATURE----- --=-1207727525-810746-59991-4328-8-=--