From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 4C8207EC76 for ; Tue, 12 May 2015 23:01:49 +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=209.85.212.171; 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 209.85.212.171 as permitted sender) identity=mailfrom; client-ip=209.85.212.171; 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-wi0-f171.google.com) identity=helo; client-ip=209.85.212.171; receiver=mail3-smtp-sop.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: A0D+AQA1aVJVlKvUVdFcgy41XgaDGMNlhg0CgTkHOxEBAQEBAQEBEQEBAQEHCwsJHzCEIQEBAwESEQQZARsdAQMBCwYFCw8CJgICIgERAQUBHBkih3QBAwoIqh8+MYs4gWuCd4k1ChknDVeEJQEBAQEBBQEBAQEYAQUOgROKGIJ0gV4zB4JogUUFlnOGRoEkPpE2ggsSI4EMCYQ2IjGCRgEBAQ X-IPAS-Result: A0D+AQA1aVJVlKvUVdFcgy41XgaDGMNlhg0CgTkHOxEBAQEBAQEBEQEBAQEHCwsJHzCEIQEBAwESEQQZARsdAQMBCwYFCw8CJgICIgERAQUBHBkih3QBAwoIqh8+MYs4gWuCd4k1ChknDVeEJQEBAQEBBQEBAQEYAQUOgROKGIJ0gV4zB4JogUUFlnOGRoEkPpE2ggsSI4EMCYQ2IjGCRgEBAQ X-IronPort-AV: E=Sophos;i="5.13,417,1427752800"; d="scan'208";a="117964887" Received: from mail-wi0-f171.google.com ([209.85.212.171]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 12 May 2015 23:01:48 +0200 Received: by wief7 with SMTP id f7so121589142wie.0 for ; Tue, 12 May 2015 14:01:48 -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=wcJ9xtJ9Khc5pYmSbjxGSzt1ExQcduF0txF8OjzsRzM=; b=dhGapH/fZF7hJuuIUR6bN3sgntxXRVrchUGt6mzx3j36etiNcZ+KKzTFZmtH80K1BE yJ6iVIENQUQtjCbqKvb8a065BjLT/zFUqGAvRjGLL6BHAsBiMK7+D1IyuBkVHtmyHDE1 GRbtatmuxE45asWUx5lsjoAQhUjANje8qXlpkYdGs/6kf0cQiSeNp4LfdB1t0NAD4K/t Re/DgF35RaOX3yJJGIxOfdLACLbIQ5b07STB/4kel/Q6EkKFSIPMbwoy+vqQlbNFWkQE K2F5uPG66rfBTgiyFhHak40Jx2rpx/StXvw4jSdbhAGFfslm6/1T4mOASD/cmyODzjQQ I0DA== X-Received: by 10.180.12.228 with SMTP id b4mr32288431wic.92.1431464508068; Tue, 12 May 2015 14:01:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.63.8 with HTTP; Tue, 12 May 2015 14:01:07 -0700 (PDT) In-Reply-To: <20150510163426.EC8B1C38CA@www1.g3.pair.com> References: <20150510163426.EC8B1C38CA@www1.g3.pair.com> From: =?UTF-8?Q?=C3=96mer_Sinan_A=C4=9Facan?= Date: Tue, 12 May 2015 17:01:07 -0400 Message-ID: To: oleg@okmij.org Cc: OCaml Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] MetaOCaml error while running generated code that > The fix that I have mentioned in the previous message seems to > work. Before the line with Runcode.run in the file r2.ml, add this > line > > let () =3D Clflags.recursive_types :=3D true > > When compiling the code, you have to add the flag -I +compiler-lib flag t= o the > metacocamlc command line. I just tried this on my program and now it's failing with this error: =E2=9E=9C unlambda git:(master) =E2=9C=97 ./unlambda_metaocaml programs/= Hello.unl -compile Fatal error: exception Symtable.Error(_) Does that look familiar? Here's the diff of my changes: diff --git a/Makefile b/Makefile index 31ab193..4340429 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ unlambda_idris: Unlambda.idr idris $< -o $@ unlambda_metaocaml: Syntax.cmo UnlambdaInterp.cmo UnlambdaCont.cmo Lift.cmo CmdArgs.cmo UnlambdaStaged.cmo UnlambdaCompiler.cmo UnlambdaMain.ml - metaocamlc -rectypes $^ -o $@ -g + metaocamlc -rectypes -I +compiler-lib $^ -o $@ -g qbf_metaocaml: QBFSyntax.cmo QBFEval.cmo QBFMain.ml metaocamlc $^ -o $@ -g diff --git a/UnlambdaMain.ml b/UnlambdaMain.ml index 6a6f72f..8627283 100644 --- a/UnlambdaMain.ml +++ b/UnlambdaMain.ml @@ -122,6 +122,7 @@ let _ =3D end end else if opts.compile then + let _ =3D Clflags.recursive_types :=3D true in let _ =3D Runcode.run (UnlambdaCompiler.compile exp_s) (fun x -> x) = in () else begin 2015-05-10 12:34 GMT-04:00 : > > I was kind of hoping for a simpler example. So, I wrote one myself. It > has two files: > > the file r1.ml > let auto'apply g =3D g g > let fix f =3D auto'apply (fun x n -> f (auto'apply x) n) > > the file r2.ml, first version > let c =3D > .. > let r =3D Runcode.run c > let () =3D Printf.printf "The result is %d\n" r > > If we build the executable as > metaocamlc -rectypes r1.ml r2.ml > > and run the result, we see the error you have reported: > > File "_none_", line 1: > Error: Unit imports from R1, which uses recursive types. > The compilation flag -rectypes is required > > Fatal error: exception Failure("Error type-checking generated code: scope= extrusion?") > > > The fix that I have mentioned in the previous message seems to > work. Before the line with Runcode.run in the file r2.ml, add this > line > > let () =3D Clflags.recursive_types :=3D true > > When compiling the code, you have to add the flag -I +compiler-lib flag t= o the > metacocamlc command line. > > The resulting executable runs and prints the expected result. > >> I'm not using REPL. I still tried to do this but (Meta)OCaml REPL is so >> ridiculously bad I couldn't even manage to load all the dependencies of >> my program... > I guess the mileage really varies: I do all my OCaml and MetaOCaml > development using REPL. > > Well, MetaOCaml distribution includes the file to link your own REPL. > I guess one can easily make MetaOCaml-enabled utop (by linking in the > necessary libraries and the tiny object file that sets up the > necessary environment and registers the code printers). > >