In my opensolid/geometry package, I have an OpenSolid. prefix on each package name which I included to avoid potential conflicts with modules from other packages. I’m considering removing the prefixes, but this would be a breaking change and could lead to import conflicts in the future so I wanted to get some feedback from the community first!
The main advantages I see of removing the prefixes are:
- Consistency with other packages:
elm-community/elm-testuses top-levelExpect,FuzzandTestmodules,mdgriffith/style-elementsuses top-levelStyleandElementmodules,terezka/elm-plotuses a top-levelPlotmodule, etc. - Less typing (the number of times I’ve typed
import OpenSolid.Point3d as Point3d…), especially in the REPL where you can’t rely on autocompletion - Smoother integration with editors/IDEs that are optimized for unprefixed module names
- More data points for this issue if import conflicts do arise
The main disadvantages:
- Potential for conflicts: if I publish a plain
Point3dmodule, then nobody usingopensolid/geometrycan use any other package which also exposes a plainPoint3dmodule (they also can’t define their ownPoint3dmodule, but that’s a bit less of an issue) - Less clarity about imports: in the same way that seeing
List.mapin your code shows that you’re using a function from theListmodule, seeingOpenSolid.Point3din your imports hints that you’re using a module from anopensolid/*package
If I do go ahead with removing the prefixes, I might also rename the Scalar and Interval modules to Scalar1d and Interval1d so that all top-level modules have a 1d, 2d or 3d suffix (which I think should be enough to avoid conflicts with any existing published packages, and reduce the likelihood of conflicts in the future).
Thoughts? Any alternate approaches I’ve missed?