Proposal: module namespaces.
Christian Brolin
Christian.Brolin@carmen.se
Fri, 09 Mar 2001 08:23:49 +0100
Malcolm Wallace wrote:
>
> Simon Marlow wrote:
>
> > The compiler finds the file because you tell it what the filename is.
> > That's the way it works now, and if I understand correctly Malcolm isn't
> > suggesting we change that (and I agree).
>
> Yes, that's what I had in mind. My guiding design principle is that
> I want absolutely minimal changes to the current way of doing things,
> while still managing to gain new expressiveness in the module namespace.
>
> > There are really two issues here:
> >
> > * how do you find a module to compile in the first place (not an
> > issue for interpreters, only for batch compilers). Just run
> > the compiler giving it the filename.
>
> Exactly. When the dot-extended module name is explicitly given,
> in full, in the source file's "module" header, then it doesn't
> matter where the compiler is invoked from.
>
> cd .; ghc -c A/B/C/D.hs
> cd A; ghc -c B/C/D.hs
> cd A/B; ghc -c C/D.hs
> CD A/B/C; ghc -c D.hs
>
> are all equivalent. No special flags are required to tell the
> compiler that the "root" of this tree is at the parent of A. The
> source file contains everything the compiler needs to know.
Yes, it is easy to find a module file given the filename, but how does
the compiler find modules that this module imports?
--
Christian Brolin