Packages and modules
simonmarhaskell at gmail.com
Thu Jul 6 11:22:51 EDT 2006
Malcolm Wallace wrote:
> Aaron Denney <wnoise at ofb.net> wrote:
>>>>Package names should never appear in source files IMHO.
>>>I tend to the opposite view.
>>Then, as John points out, how is package Foo module A.B.C and package
>>Bar module A.B.C any different than modules Foo.A.B.C and Bar.A.B.C?
> I have great sympathy with this view - that packages are little
> different from a top-level name in the hierarchy.
> But Simon PJ's comment (on the wiki page) about the difference between
> specifying the _purpose_ of a module in its name, and the _provenance_
> of a module in its package identifier, was very convincing.
> I have added (yet another) alternative proposal, to the wiki here:
I've digested this, and I hope can regurgitate the key points for anyone
wishing to grasp it quickly. Please correct me if I get anything wrong:
- the proposal is to let you specify grafting in the source code
- you graft a *sub-hierarchy* of a package anywhere in the
global module namespace (the sub-hiearchy bit is new, I haven't
seen this proposed before).
- you can also graft a sub-hierarchy of a package onto the
*current module*, so that it becomes available when importing
this module. This is new too.
Personally I'm not convinced the extra generality of grafting
sub-hierarchies is necessary. The re-export idea is interesting, though.
More information about the Libraries