Currently, such layout can be handled by
dune with virtual-modules (no variants). The first library, as far as know, which uses this " trick" (we initially talked about “linked-trick”) is
mtime to be able to compile the project in native and with
js_of_ocaml - So, the
*.cmx is chosen depending on the target.
It is the same “layout” for
checkseum which use
dune. By this way, we are able to use them with
js_of_ocaml too. This is the most interesting case where usability can become complex. Outside the scope of
dune, it’ s easy to have a linking error because you did not specify the right
*.cmx/implementation at the link-time.
About maintainability, it can be a problem specially for
checkseum where you must maintain twice implementation. So I prefer to advise to not use virtual modules or use them into a restricted area (instead of using them systematically instead of functors).