What makes Rust different from OCaml is that with Rust, the cargo
executable acts as both a package manager and a build system. For example, you just need to add a dependency to Cargo.toml
and the next time you run cargo build
, Cargo will download the dependency before building your program. In contrast, OCaml’s opam is just a package manager, and you need a separate program for the build system, usually Dune nowadays. One consequence is that you need to list your dependencies in the opam file for the package manager and in the dune file for the build system. What’s more confusing is that these two files use different types of library names, which dbuenzli points out is an obstacle for newcomers. Dune’s feature to generate the opam file automatically doesn’t add much improvement because you still need to list the dependencies twice, since the two places use different types of names.
6 Likes