No, OCaml does not support true module anti-aliasing.
However, you probably won't notice until you try a fairly complex combination of functors and abstract types. In particular, this problem can only be observed in the type system, and not during program ModuleWithLongName.foo : modules are sometimes copied, but mutable states will be smoothed between copies (in your example, if ModuleWithLongName.foo is a mutable link, then M.foo is one same link).
If you use first-class modules or define local modules in deeply nested functions, you can observe the operation of copying modules as an invaluable cost in general computing. The right mental model for determining the performance of first-class modules is that after type checking and module checking, they are accurately written.
source share