caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Ömer Sinan Ağacan" <omeragacan@gmail.com>
To: oleg@okmij.org
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] MetaOCaml error while running generated code that needs -rectypes
Date: Thu, 7 May 2015 17:49:48 -0400	[thread overview]
Message-ID: <CAMQQO3m6EFY7O3FncYTWnPUNcRufNAHxaNmZRC=Hfi_gbAwY=A@mail.gmail.com> (raw)
In-Reply-To: <20150507155955.B8F9EC3841@www1.g3.pair.com>

> Is the code that contains the Runcode.run <your code> also compiled
> with -rectypes?

Yes, otherwise I'm having a compile time error.

> Anyway, I think forcing recursive_types flag right before Runcode.run
> may help. Here is how to do it, if ruiining at the top level:
>
> #directory "INSTALLPREFIX/lib/ocaml/compiler-libs/";;
> Clflags.recursive_types := true

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...

> If you compile the code first, then you need to add -I +compiler-libs
> to the command line of the compiler. If the problem persists, it would
> help to have a small test case.

What do you mean by "compile the code first"?

My program is in a Github repo, here's how to reproduce:

  $ git clone https://github.com/osa1/int-proj.git
  $ cd int-proj
  $ make unlambda_metaocaml
  $ ./unlambda_metaocaml programs/Hello.unl -compile
  File "_none_", line 1:
  Error: Unit  imports from UnlambdaFuns, which uses recursive types.
         The compilation flag -rectypes is required

  Fatal error: exception Failure("Error type-checking generated code:
scope extrusion?")

Thanks.

2015-05-07 11:59 GMT-04:00  <oleg@okmij.org>:
>
>> I'm trying to generate some code that needs -rectypes. I'm compiling all
>> modules using -rectypes and things mostly work fine, except I can't run
>> MetaOCaml generated code, because it's failing with:
>>
>>   File "_none_", line 1:
>>   Error: Unit  imports from UnlambdaFuns, which uses recursive types.
>>          The compilation flag -rectypes is required
>
> Is the code that contains the Runcode.run <your code> also compiled
> with -rectypes?
>
> Anyway, I think forcing recursive_types flag right before Runcode.run
> may help. Here is how to do it, if ruiining at the top level:
>
> #directory "INSTALLPREFIX/lib/ocaml/compiler-libs/";;
> Clflags.recursive_types := true
>
> If you compile the code first, then you need to add -I +compiler-libs
> to the command line of the compiler. If the problem persists, it would
> help to have a small test case.

  reply	other threads:[~2015-05-07 21:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 17:54 Ömer Sinan Ağacan
2015-05-07 15:59 ` oleg
2015-05-07 21:49   ` Ömer Sinan Ağacan [this message]
     [not found]     ` <20150510163426.EC8B1C38CA@www1.g3.pair.com>
2015-05-12 21:01       ` [Caml-list] MetaOCaml error while running generated code that Ömer Sinan Ağacan
2015-05-14 11:43         ` oleg

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='CAMQQO3m6EFY7O3FncYTWnPUNcRufNAHxaNmZRC=Hfi_gbAwY=A@mail.gmail.com' \
    --to=omeragacan@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=oleg@okmij.org \
    /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;
as well as URLs for NNTP newsgroup(s).