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 E77257FCCB for ; Sun, 3 May 2015 03:57:45 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of omeragacan@gmail.com) identity=pra; client-ip=74.125.82.42; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="omeragacan@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of omeragacan@gmail.com designates 74.125.82.42 as permitted sender) identity=mailfrom; client-ip=74.125.82.42; receiver=mail3-smtp-sop.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 (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f42.google.com) identity=helo; client-ip=74.125.82.42; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="omeragacan@gmail.com"; x-sender="postmaster@mail-wg0-f42.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CbAgD2f0VVmypSfUpcgys0XAWDGMJOgU6GDAKBNQc5EwEBAQEBAQERAQEBAQEGCwsJIS6EIQEBBBIRHQEbHQEDDAYFCw0CAiYCAiEBAREBBQEcBhMbB4d0AQMRphE+MYs5gWuCdogZChknDVaESAEBAQEBAQQBAQEBARcBBQ6BE4oYgk2CBTMHgmiBRQWWHoRsgVWBYY1dhRYSI4EMCYIIgisiMYJFAQEB X-IPAS-Result: A0CbAgD2f0VVmypSfUpcgys0XAWDGMJOgU6GDAKBNQc5EwEBAQEBAQERAQEBAQEGCwsJIS6EIQEBBBIRHQEbHQEDDAYFCw0CAiYCAiEBAREBBQEcBhMbB4d0AQMRphE+MYs5gWuCdogZChknDVaESAEBAQEBAQQBAQEBARcBBQ6BE4oYgk2CBTMHgmiBRQWWHoRsgVWBYY1dhRYSI4EMCYIIgisiMYJFAQEB X-IronPort-AV: E=Sophos;i="5.13,358,1427752800"; d="scan'208";a="114313583" Received: from mail-wg0-f42.google.com ([74.125.82.42]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 03 May 2015 03:57:18 +0200 Received: by wgso17 with SMTP id o17so120597385wgs.1 for ; Sat, 02 May 2015 18:57:17 -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:content-transfer-encoding; bh=dZRkzynoGbXeqlpa+DLhzPFdN3o/p/ZJ2fv19Nh9AnI=; b=lkjXSO/pn0DKA+TLxSsa2Bm7wyV9fKiaAPTXVovXBdOYKplVaMp4yShJcOUrUPAkxJ CCMglVJU8Fj+sqXPLehYEUXrUbrZQsA3USEUAo68BcHNp2NP/yGgvb4pev3lRYyqzBA4 tSkF6EqIsHscCscZ/2lu54A6R5Zng3JupQ+2usFPJ06CfEOAO2GAooftGLqLN7JKElaQ 44NUfp74Kq8MUtMA8RA49Qz/Gzig11aHtmdL/EsKLhBXJa9dIg5+tCVOM80EQpIFDBZy q5gLv7rILP78InVLRNrL8N9WMbNx+m0mUanMAbEYMQEJG14N0il3Rc1jZzzBQgSBcjSz U8+g== X-Received: by 10.180.91.76 with SMTP id cc12mr8638114wib.67.1430618237320; Sat, 02 May 2015 18:57:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.187.212 with HTTP; Sat, 2 May 2015 18:56:36 -0700 (PDT) In-Reply-To: <5545384D.40803@mcmaster.ca> References: <20150501112114.1C8DFC382A@www1.g3.pair.com> <1430496980.1158661.261513285.08E1920C@webmail.messagingengine.com> <1430498707.1164081.261525093.47AD6B00@webmail.messagingengine.com> <5545384D.40803@mcmaster.ca> From: =?UTF-8?Q?=C3=96mer_Sinan_A=C4=9Facan?= Date: Sat, 2 May 2015 21:56:36 -0400 Message-ID: To: Jacques Carette Cc: OCaml Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Problems with printing MetaOCaml generated code That's not a solution. I should be able to generate some values in code generation time and persist them in code values, that's the whole point here. 2015-05-02 16:49 GMT-04:00 Jacques Carette : > try instead > let stx1 =3D .< A >. in > and then > print_code std_formatter .< .~stx1 >. ; > > That ought to work as you wish. > > Jacques > > > On 2015-05-02 2:45 PM, =C3=96mer Sinan A=C4=9Facan wrote: >> >> In case anyone's still interested, I produced a very simple example that >> demonstrates the issue: >> >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 ls >> Main.ml Syntax.ml >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 cat S= yntax.ml >> type stx =3D >> | A >> | B of stx >> | C of (stx * stx) >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 cat M= ain.ml >> open Format >> open Print_code >> open Runcode >> open Syntax >> >> let _ =3D >> let stx1 =3D A in >> let stx2 =3D B A in >> let stx3 =3D C (A, A) in >> >> print_code std_formatter .< stx1 >.; >> print_code std_formatter .< stx2 >.; >> print_code std_formatter .< stx3 >.; >> >> print_closed_code std_formatter (close_code .< stx1 >.); >> print_closed_code std_formatter (close_code .< stx2 >.); >> print_closed_code std_formatter (close_code .< stx3 >.); >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 metao= camlc Syntax.ml -c >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 metao= camlc >> Syntax.cmo Main.ml -o main >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 ./main >> .<(* CSP stx1 *) Obj.magic 0>. .<(* CSP stx2 *)>. .<(* CSP stx3 *)>. = .< >> (* CSP stx1 *) Obj.magic 0>. .<(* CSP stx2 *)>. .<(* CSP stx3 *)>. >> =E2=9E=9C metaocaml_serialization_issue git:(master) =E2=9C=97 >> >> >> 2015-05-01 12:53 GMT-04:00 =C3=96mer Sinan A=C4=9Facan : >>>> >>>> You can't serialize `eval_ref` as `eval_ref` because that is a local >>>> identifier. If you print out `eval_ref` into some other ml file and >>>> compiler >>>> it, it is going to give an "Unbound identifier eval_ref" error. >>> >>> That's true. Just to make sure and make the output more clear, I moved >>> the >>> relevant code to another module, and now it's printing this: >>> >>> .. >>> >>> My main question is that it should serialize p' here, but it doesn't. I= 'm >>> trying to understand why. > >