Dune utop limitations

I was excited to see that dune utop would launch me into utop with my application under development loaded. But then discovered that it actually didn’t do that because currently my app is just a main.ml (with dune and opam meta data around it) that depends on some external libraries. Reading the documentation it says:

dune utop DIR build and run utop toplevel with libraries defined in DIR

So it would only load libraries that are defined in my app (of which there are none) – fine. But it surely would load all the external libraries that my code depends on? Turns out it does not. Altogether I have no clear picture what this does, how it is useful, and how to structure my project to make the most out of it.

1 Like

Because it doesn’t load any of your libraries, it also doesn’t load any external library. Binaries are simply ignored.

The strategy at ahrefs so far has been to have a very lean binary and put almost all the code in a library. It adds a little bit of boilerplate. But that’s a little cost to be able to use dune utop.

4 Likes

Thank you. I’ve adopted the strategy in my trivial hello project which I use to launch new projects.