[ccan] Moving modules to vanity naming?

Joseph Adams joeyadams3.14159 at gmail.com
Wed Nov 3 17:18:54 EST 2010


My two cents:

Even if CCAN has a thousand packages, I think that a listing of all
modules on one page should still be available.  Although such a
listing might be a firehose, it's really useful when you want to
search for modules with good old Ctrl+F.

I've been working with Haskell for a while, and its treatment of the
namespace problem is quite interesting.  Thanks to the way module
importing works, you can use modules that have colliding function
names simultaneously.  Better yet, colliding function names are
standard practice, as it leads to consistency.  For example:

	Data.List: http://haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/Data-List.html
	Data.ByteString:
http://www.haskell.org/ghc/docs/6.12.2/html/libraries/bytestring-0.9.1.6/Data-ByteString.html

Data.ByteString uses a whole lot of function names that Data.List
uses.  To keep this from being a problem, a module wanting to use both
can say:

import Data.List
import qualified Data.ByteString as S

Then it can say S.splitAt to refer to the one in Data.ByteString, or
just splitAt to refer to the one in Data.List.

Not sure if this would be a good thing to apply to CCAN, but it's an
interesting lesson on how running away from namespace-ophobia can be a
good thing.  By learning what the functions in Data.List do, you also
learn what most of the functions in Data.ByteString do.  I don't think
you'll find that kind of pervasive consistency anywhere else.


More information about the ccan mailing list