Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Kenichi Asai <asai@is.ocha.ac.jp>
To: caml-list@inria.fr
Subject: [Caml-list] utop execution of multiple OCaml files
Date: Fri, 15 Aug 2025 09:50:29 +0900	[thread overview]
Message-ID: <aJ6EVfs-567_hffY@pllab.is.ocha.ac.jp> (raw)

Suppose I have a.ml that uses definitions in b.ml (and possibly more).
To compile these files, all I need to do is to prepare a dune file
that mentions only the main file: (executable (name a)), and type
"dune build".

But before I compile the whole program, I often want to play with
functions in a.ml using OCaml toplevel, like utop.  If b.ml were
registered as a library, I could do it by "dune utop ." and then "#use
a.ml".  But to do so, I need to create a directory for the library and
create another dune file for it.

Is there a way to load all the modules into utop, just as simple as
typing "dune build" for the compilation case?

Perhaps, there is a tool to analyze the dependency and produce a list
of commands like the following?

#mod_use "b.ml";;
#mod_use "a.ml";;

-- 
Kenichi Asai

             reply	other threads:[~2025-08-15  0:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-15  0:50 Kenichi Asai [this message]
2025-08-15 11:37 ` Kate

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=aJ6EVfs-567_hffY@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