From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 1440A7FCCB for ; Thu, 30 Apr 2015 20:36:59 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of omeragacan@gmail.com) identity=pra; client-ip=209.85.212.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="omeragacan@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of omeragacan@gmail.com designates 209.85.212.171 as permitted sender) identity=mailfrom; client-ip=209.85.212.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="omeragacan@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-wi0-f171.google.com) identity=helo; client-ip=209.85.212.171; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="postmaster@mail-wi0-f171.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CvAQDudEJVlKvUVdFcg19cBYMWxAyHWgc7EQEBAQEBAQERAQEBAQcLCwkfMIQ5ER0BGx4DEhAPAiYCJAERAQUBIhsah3QBAxENpSqDLj4xizmBa4J2iH4KGScNVYRwAQUOgRONAoUJgUUFlXOGP4FgklMSI4EMCYF1NRyBbSIxgkUBAQE X-IPAS-Result: A0CvAQDudEJVlKvUVdFcg19cBYMWxAyHWgc7EQEBAQEBAQERAQEBAQcLCwkfMIQ5ER0BGx4DEhAPAiYCJAERAQUBIhsah3QBAxENpSqDLj4xizmBa4J2iH4KGScNVYRwAQUOgRONAoUJgUUFlXOGP4FgklMSI4EMCYF1NRyBbSIxgkUBAQE X-IronPort-AV: E=Sophos;i="5.11,677,1422918000"; d="scan'208";a="138374823" Received: from mail-wi0-f171.google.com ([209.85.212.171]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 30 Apr 2015 20:36:58 +0200 Received: by wizk4 with SMTP id k4so30318650wiz.1 for ; Thu, 30 Apr 2015 11:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=aZG8RMKcVj+nYOL0CMBPL1uZxqsr98DIYcM+CZh035o=; b=tIBEP+DIAFKtW+4vpzEcwEeka1MY9cUpzeQ+JJR2tYaB6X5zyhsLF6iWbqNQ6Do7Nx vyXXTU+BsV0wzrs9SemCcmsHLvoeQ4MRD5xlI+KDg96ouKOG6evJ11A6gi7UUnSFpo6L UtjmiBoHVWDmawywANXFAIal1TU0l8sDE7HB94zY/voI5FMSqiQ5mxgDQVz3+Q3kc4vj Jr8eC1miOZPzYZOlq1FiiMh9/VJQtVeEIldMvFnq/atdiYhEtFXEQfIMP+Wr+bqcjnBB ZxConJt0Ce74DU2VscgDwQr1FTnNB8xq3YtB2102mESylK2quHAk6O6LB6+lIS5Jf3OV 58eg== X-Received: by 10.194.47.231 with SMTP id g7mr10905057wjn.140.1430419018349; Thu, 30 Apr 2015 11:36:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.187.212 with HTTP; Thu, 30 Apr 2015 11:36:17 -0700 (PDT) From: =?UTF-8?Q?=C3=96mer_Sinan_A=C4=9Facan?= Date: Thu, 30 Apr 2015 14:36:17 -0400 Message-ID: To: OCaml Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Caml-list] Problems with printing MetaOCaml generated code Hi all, I'm working on a MetaOCaml program and I want to save generated programs to files instead of directly running them within the same program using `Runcode.(.!)` or `Runcode.run`. The problem is MetaOCaml never prints generated code, it's always failing with `Warning 22: The CSP value is a closure or too deep to serialize`. I can't see anything related in it's web page: http://okmij.org/ftp/ML/MetaOCaml.html. What I understand from that page is once I have a closed code, I should be able to print it no matter what. However in my experience even the simplest realistic MetaOCaml program fail= s to generate the code because of this error I mentioned above. (One thing to note here is that my program generates the code on a couple of inputs, but fails in most of them with this error message.) In "Many ways to run the code" section it's said that "Since closed code is essentially OCaml AST, after closing the generated code, the user may exami= ne and `run' it in many ways. One way of running the code is printing it." and then it lists some API functions for printing. In my experience none of them really work, I have closed code which I successfully closed using `Runcode.close_code`, but `print_closed_code` is still failing with the err= or, and `print_code_as_ast` is printing something that definitely doesn't look = like an AST for any imaginable programming language.(okay... I might have exaggerated a bit, but it's definitely not OCaml AST and it contains some references to generator program source, like "Generator.ml[248]" for exampl= e) One relevant thing I could find in the documentation is this: "If the code includes CSP only as literals or external references (and any code can be arranged that way), the code can be stored into a file and then passed to ocamlopt." If we remove this sentence from the documentation, I don't think= it mentions about any possible failures in code printing. So now that I've expressed my frustration about this, I guess my main quest= ion is: In what cases does MetaOCaml prints generated code? In what cases it doesn't? Note that it fails to generate code even after calling `print_closed_code (close_code ...)`, so being closed or not doesn't seem v= ery relevent here. Is this a bug in MetaOCaml? Are there any workarounds? Any i= deas what am I doing wrong? Thanks in advance for any answers, =C3=96mer