Namespaces

Johan Nordlander nordland@cse.ogi.edu
Wed, 10 Oct 2001 16:58:07 -0700


On Wednesday, October 10, 2001, at 12:29  PM, Hal Daume III wrote:

> So, barring this, I'm curious how other people handle this issue.
>
> I have multiple projects.  Call them A, B, C.  They are in directories:
>   ~/projects/A
>   ~/projects/B
>   ~/projects/C
> repsectively.
>
> Say I'm creating a new project, D, in ~/projects/D that uses code that
> I've written in packages A, B and C.  Now, as far as I can see, I have
> two options:
>
>  1) Copy all the .(l)hs files from /A, /B, and /C to /D that I need to
> import
>  2) Include projects/A, projects/B and projects/C in my search path for
> ghc(i)
>
> I hate both of these options.  1 is terrible because I have multiple
> copies of the same code lying around and, if I make changes to one, I
> have to remember to copy the changes over to the others.  2 is a big
> nuisance, especially since ghc (seems to) lack an environment variable
> that it looks at to get command line options every time it runs
> (HUGSFLAGS, I think it was for Hugs).
>
> So is there a third option that I'm missing?  How do other 
> people handle
> this issue?
>
>  - Hal

Using the new hirarchical module namespace soon to be supported 
by both Hugs and GHC:

    Set the search path to ~/projects and import A.M, B.N, etc.

The only additional requirement here is that your module M in A 
must be renamed A.M, and so forth.

How does that sound?

-- Johan