Properly wrap a package’s modules with dune

Your system is basically replicating -for-pack but using a preprocessor. Unfortunately, the fundamental problem with this technique is that you will never decent incremental build times as the number of modules and libraries will increase.

However, one way to improve the current system without waiting on namespaces is to agree on some sort of convention for private modules. One way is indeed to bless the Alias__ convention in tools such as utop, odoc, etc. Another possibility is agree on some sort of ppx attribute for marking modules as “private” ([@@@private] for example). The advantage of this is that it’s independent of any mangling scheme and that it will also work for private modules in unwrapped mode. Of course dune will need to be updated to emit this modules that follow this convention.