ocaml / dune

A composable build system for OCaml.
https://dune.build/
MIT License
1.63k stars 401 forks source link

Add dune facilities in the toplevel #5569

Open bobot opened 2 years ago

bobot commented 2 years ago

Dune specific facilities like dune-build-info, virtual libraries, ... requires specific handling during linking. Dune could provide improved #require facilities in the toplevel using dune-plugin-site (work outside a dune workspace, less scanning, but only use META) or dune-rpc (can give access to local libraries, could use dune-package information).

Such feature should be added step by step, first redo the current #require feature, then ... but at the end the long run would be:

It would help for:

rgrinberg commented 2 years ago

One question I have is how do you plan to hide the dune rpc library itself and its dependencies in the repl. For example, dunerpc depends on stdune, is the user going to have Stdune available as an identifier?

bobot commented 2 years ago

I think there is no obligation to add a library in the toplevel scope when it is used by the interpreter.

rgrinberg commented 2 years ago

Could you explain a bit more how would this work? How is #require-private going to communicate with dune? Do you expect that we will build a custom toplevel, or are we going to use #use_output "dune .." to activate the support. If it's the latter, I'm not sure how it's going to work.

bobot commented 1 year ago

The simplest would be to modify upstream utop to add the feature through dune rpc and Topcommon.add_directive. We can also build a custom toplevel that adds the feature. Or allows to load it in the same way ocamlfind was. But I think having first a working version in utop would be the best first step.