Closed rgrinberg closed 6 years ago
Some modules like ISet
and IMap
in CamomileLibrary.Private
are useful for other user. In future, they would be worthwhile to publish them as a separate package. Other modules like xArray
and byte_labelled_dag
can be replaced to modules from other packages, so can be eliminated. Others like Hangul
would be a part of public
modules. Unidata
is a purely internal module so we need to hide from the users. Anyways, we can restructure the modules and can reduce the number of private
modules in future.
This PR restructures camomoile to use module aliases rather than the manual packing we had before. This means that there should be no more conflicts with other libraries, as all of our compilation units will be prefixed with
Camomile__
. Our users gain compatibility with stdlib's uchar (since we no longer have a uchar.cmi) and their binary sizes should decrease, because module aliases aren't opaque to the dead code elimination.I've also done a few other changes along the way:
I've split Camomile into multiple sub libraries. This is really only done to maintain the compatibility at the findlib level. When a user uses
-package camomile
they will still get all the toplevel module names that they expect. It's quite ugly how this is achieved but hopefully for 2.0 we'll have a real re-org done where such hacks won't be necessary.I got rid of the .mli only modules. They have no benefits and have subtle gotchas.
I also simplified our jbuild files. I think it's easier if we simply glob everything from private and public. Even simpler would be to move the public dir to the root as it's really obvious that whatever isn't inside
private
is public. We should also consider getting rid of theprivate
dir as well. As we end up listing the private modules in the entry level module (see the point below).I've moved the internal modules to
CamomileLibrary.Private
. It's a shame that these are now available to the user. But hopefully thePrivate
suffix will urge them not to use these modules. In the future, jbuilder will support true private module via .cmi hiding. But I think the current workaround suffices for today.