I also personally like the clarity that comes from the separation.
That said, there are things that I find annoying about interface files:
- We can’t jump to a specific function implementation from interface (I think?).
- As a consequence of (1), we can’t jump to implementation from a documentation page.
- If you’re doing API-driven development, it would be nice to be able to automatically generate an
.ml
file with stub functions that satisfies the interface. A blog at Jane Street has a way to work around this but I think an editor support is nice to have.
I think .mli
files could (and should), if present, be used as hints to do the .ml
. Just like in Java where you say a class is implementing an interface, then the IDE would tell you that you’re missing an implementation of such-and-such methods.