Packages and modules

Malcolm Wallace Malcolm.Wallace at
Fri Jul 7 05:20:14 EDT 2006

Simon Marlow <simonmarhaskell at> wrote:

> >
> Please correct me if I get anything wrong:
>    - the proposal is to let you specify grafting in the source code

This is not the main focus of the proposal.  Grafting is one
oft-requested feature that is not currently supported, but yet it seems
very close to the idea of specifying a package dependency in the source
code.  So my intention is merely to take it into account when designing
the latter facility.  If one mechanism (with a little tweaking) can
achieve both aims, so much the better.

The central plank of my proposal is to introduce an explicit concept of
"namespace".  Namespaces can be managed separately from the imports that
range over them.  That's it.

>    - 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).

The ability to graft hierarchies is just a side-effect.  I would phrase
this point as

   - a "namespace" is a sub-hierarchy of the modules contained in a
     package.  (The sub-hierarchy bit is indeed new.)

>    - 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.

Again, I would rephrase this:

   - "namespaces" can be imported and exported, separately from the
     modules they contain.  (Yes, this is new too.)


More information about the Libraries mailing list