caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] expansion of #use?
@ 2020-05-18 11:32 Kenichi Asai
  2020-05-19  9:34 ` Kenichi Asai
  0 siblings, 1 reply; 4+ messages in thread
From: Kenichi Asai @ 2020-05-18 11:32 UTC (permalink / raw)
  To: caml-list

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-23 11:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 11:32 [Caml-list] expansion of #use? Kenichi Asai
2020-05-19  9:34 ` Kenichi Asai
2020-05-22  5:50   ` Kenichi Asai
2020-05-23 11:00     ` orbifx

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