Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Leo White <leo@lpw25.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Problems with printing MetaOCaml generated code
Date: Fri, 01 May 2015 12:16:20 -0400	[thread overview]
Message-ID: <1430496980.1158661.261513285.08E1920C@webmail.messagingengine.com> (raw)
In-Reply-To: <CAMQQO3=nirMojoCsdGvK0EVov6FZj059p3xdUC7h8w84-eQXAQ@mail.gmail.com>

> Can we talk about what is non-serializable here? I pushed some code to a
> public repo for demonstration purposes. I have a simple interpreter for
> a simple language. I'm experimenting with different levels of
> interpreter specializations(aka. first Futamura projections). As a
> simplest specialization, I want to eliminate parsing costs. The code
> that's supposed to do this is here:
> 
> https://github.com/osa1/int-proj/blob/master/Unlambda.ml#L204
> 
> `p'` in that code is lifted, and it's parsed syntax tree of given source
> file. Syntax tree is defined here:
> 
> https://github.com/osa1/int-proj/blob/master/Syntax.ml#L63
> 
> I think it doesn't have anything that's not serializable: It's just a
> simple monomorphic type, doesn't have any closures etc.
> 
> But MetaOCaml is failing to print this code. To try it yourself, make
> sure you have metaocamlc in $PATH, and run:
> 
>   ➜  unlambda git:(master) ✗ make unlambda_metaocaml
>   metaocamlc -c Syntax.ml
>   metaocamlc Syntax.cmo Unlambda.ml -o unlambda_metaocaml
> 
>   ➜  unlambda git:(master) ✗ ./unlambda_metaocaml programs/Hello.unl stage0
>   File "Unlambda.ml", line 204, characters 67-69:
>   Warning 22: The CSP value is a closure or too deep to serialize
>   File "Unlambda.ml", line 204, characters 58-66:
>   Warning 22: The CSP value is a closure or too deep to serialize
>   .<(* CSP eval_ref *) (* CSP p' *) []>.
> 

From a quick look at the code, it seems pretty clear that `eval_ref` is not serializable.
It is a local function so there is no AST fragment which could represent it globally. I
suspect that if you moved `eval_ref` into a separate module, so that it was
a global function, then this code would work.

Regards,

Leo

  reply	other threads:[~2015-05-01 16:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 18:36 Ömer Sinan Ağacan
2015-04-30 19:52 ` Jacques Carette
2015-04-30 20:25   ` Ömer Sinan Ağacan
2015-04-30 20:57     ` Ömer Sinan Ağacan
2015-04-30 21:35       ` Jeremy Yallop
2015-05-01 11:21       ` oleg
2015-05-01 14:34         ` Ömer Sinan Ağacan
2015-05-01 16:16           ` Leo White [this message]
2015-05-01 16:41             ` Ömer Sinan Ağacan
2015-05-01 16:45               ` Leo White
2015-05-01 16:53                 ` Ömer Sinan Ağacan
2015-05-02 18:45                   ` Ömer Sinan Ağacan
2015-05-02 20:49                     ` Jacques Carette
2015-05-03  1:56                       ` Ömer Sinan Ağacan
2015-05-03  2:28                         ` Jacques Carette
2015-05-03  3:19                           ` Ömer Sinan Ağacan
2015-05-03  8:40                             ` Gabriel Scherer
2015-05-03 14:28                               ` Ömer Sinan Ağacan
2015-05-03 15:24                                 ` Leo White
2015-05-03 15:50                                   ` Ömer Sinan Ağacan
2015-05-06  9:50           ` oleg
2015-05-06 15:58             ` Jeremy Yallop
2015-05-06 16:45               ` Yotam Barnoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430496980.1158661.261513285.08E1920C@webmail.messagingengine.com \
    --to=leo@lpw25.net \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox