19 Aug 01:30
Proposal: Reserved module namespace for packages on Hackage
From: David Menendez <dave <at> zednenem.com>
Subject: Proposal: Reserved module namespace for packages on Hackage
Newsgroups: gmane.comp.lang.haskell.libraries
Date: 2008-08-18 23:32:57 GMT
Subject: Proposal: Reserved module namespace for packages on Hackage
Newsgroups: gmane.comp.lang.haskell.libraries
Date: 2008-08-18 23:32:57 GMT
In the interests of reducing module name collisions, I suggest reserving part of the module name space for individual packages on Hackage. Specifically, I'm suggesting that a new top-level module name, "Lib", be added to the module naming conventions, and that the children of "Lib" be reserved for the Hackage package with the same name. That is, "Lib.Foo" and "Lib.Foo.*" would be reserved for the package "Foo" on Hackage. This would not require packages to *use* this namespace. However, packages that do use it would have a greatly reduced chance of conflicting with other packages. Implementation costs are minor. At most, we might want some code in Hackage to prevent packages from using module names reserved for other packages. At the least, all we need to do is add "Lib" to the list of allowable top-level module names. Developers who object to giving the provenance of a module in its name are free to take their chances with the rest of the module hierarchy. Mapping package names to module names is mostly straightforward. According to the Cabal documentation, a package name consists of one or more alphanumeric words separated by hyphens, where each word contains at least one letter. Since hyphens aren't allowed in module names, they would get mapped to underscores, which are not allowed in package names. Thus, "Lib.Foo_Bar" would be reserved for package "Foo-Bar". It's less obvious what to do with packages whose names start with lower-case letters or digits. I see three possible solutions:(Continue reading)
I don't think it's necessary. The
existing recommendations on naming mean we already don't get too many
clashes, eg we get Database.HDBC and Database.HSQL. Even when names do
clash they're typically implementations of similar things and how many
packages need both at once? It's more common to pick one implementation
of some functionality.
It would certainly be interesting to make a service on hackage to work
out what packages do have clashing names so that maintainers can work
out with each other how to resolve things. For example suppose we have
two packages implementing Text.PrettyPrint then we'd ask both to
use Text.PrettyPrint.ImplName. If we allowed overlap in the modules
exported by the packages in use then both can still
export Text.PrettyPrint that just
re-exports Text.PrettyPrint.ImplName. That way one can pick and no
RSS Feed