caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kenichi Asai <asai@is.ocha.ac.jp>
To: caml-list@inria.fr
Subject: [Caml-list] expansion of #use?
Date: Mon, 18 May 2020 20:32:03 +0900	[thread overview]
Message-ID: <20200518113203.GA26442@pllab.is.ocha.ac.jp> (raw)

Is there any way to expand the use of #use?  Suppose I have the
following two files:

a.ml:
let a = 3

b.ml:
#use "a.ml";;
print_int a

Given the file name b.ml, 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 toploop.ml, 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	other threads:[~2020-05-18 11:32 UTC|newest]

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:50   ` Kenichi Asai
2020-05-23 11:00     ` orbifx

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=20200518113203.GA26442@pllab.is.ocha.ac.jp \
    --to=asai@is.ocha.ac.jp \
    --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;
as well as URLs for NNTP newsgroup(s).