I think modules and functors, as they are constructs of the language, should be presented independently of dune (and also of utop). I do think most of your examples would be fine with just using plain ocamlc/ocamlopt
, if the goal is to explain the language constructs. For modules of course, an important part is their interaction with files and how .ml/.mli files map to modules and signatures.
And it would be fine (imho) if at the end of module tutorial you ended up with 4 ocamlc
lines to build your example. The conclusion could be that yes, modules are a fine language construct, but compiling everything by hand is tedious. There are various ways to simplify this:
That’s pretty much what I have in mind. Divide and conquer.
I do think that module aliasing should be covered in a modules tutorial. It’s pretty basic and not very difficult. See for example: demos_obazl/makefiles/ns at main · obazl/demos_obazl · GitHub
This would presumably be helpful even to those who decide they want to use Dune, since it would explain why funny filenames like Foo__a.ml get generated.