ocaml / dune

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

`dune utop --watch` Appears to be broken #6817

Open abhillman opened 1 year ago

abhillman commented 1 year ago

Expected Behavior

If a file that has been loaded by utop has been changed (e.g. a local library), the source will be re-built and the latest version (if compilation is successful) will be available to utop.

Actual Behavior

--watch appears to do nothing

Reproduction

Simply run dune init project newproj and create a library with some function. From there, run dune utop and note that the function works; then modify the source for the function, and note that the old version is used by utop. By contrast, note that dune build --watch appears to work.

Specifications

abhillman commented 1 year ago

Related discussion https://alan.petitepomme.net/cwn/2022.08.30.html

abhillman commented 1 year ago

Screenshot of the man page for dune-utop that mentions --watch:

image
abhillman commented 1 year ago

One workaround I just discovered, which I haven't quite seen documented before:

$ utop
# use_output "dune top";;

Then in a separate window, edit a file and then run dune build; then go back to utop and write # use_output "dune top";; again.

Seems to me could be bundled into a little method that could be stored in a config file or something like that.

Alizter commented 1 year ago

@rgrinberg @emillon We don't support the watch flag for dune ocaml utop is that correct?

rgrinberg commented 1 year ago

Not yet. It would require a little more design to spec how this would work.