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-test
uses top-levelExpect
,Fuzz
andTest
modules,mdgriffith/style-elements
uses top-levelStyle
andElement
modules,terezka/elm-plot
uses a top-levelPlot
module, 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
Point3d
module, then nobody usingopensolid/geometry
can use any other package which also exposes a plainPoint3d
module (they also can’t define their ownPoint3d
module, but that’s a bit less of an issue) - Less clarity about imports: in the same way that seeing
List.map
in your code shows that you’re using a function from theList
module, seeingOpenSolid.Point3d
in 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?