caml-list - the Caml user's mailing list
 help / Atom feed
From: Kenichi Asai <>
Subject: [Caml-list] expansion of #use?
Date: Mon, 18 May 2020 20:32:03 +0900
Message-ID: <> (raw)

Is there any way to expand the use of #use?  Suppose I have the
following two files:
let a = 3
#use "";;
print_int a

Given the file name, I want to obtain:

let a = 3 ;;
print_int a

The -dsource option of ocaml almost does it, but it executes the
program at the same time.  In the above program, it prints 3, too.

So far, I tweak into the OCaml implementation, turn off the execution
in execute_phrase in, and re-compile whole the OCaml.  I
wonder if I can do the same thing simpler than this, possibly using
compiler libs?

Thank you in advance.

PS. I know I should not use #use from the first place.

Kenichi Asai

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 11:32 Kenichi Asai [this message]
2020-05-19  9:34 ` Kenichi Asai
2020-05-22  5:51   ` Kenichi Asai
2020-05-23 11:01     ` orbifx

Reply instructions:

You may reply publically 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:

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

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

caml-list - the Caml user's mailing list

Archives are clonable: git clone --mirror

AGPL code for this site: git clone public-inbox