Proposal: module namespaces.

Christian Brolin
Tue, 27 Feb 2001 14:20:22 +0100

Malcolm Wallace wrote:
> Proposal 1
> ----------
> Introduce nested namespaces for modules.  The key concept here is to
> map the module namespace into a hierarchical directory-like structure.
> I propose using the dot as a separator, analogous to Java's usage
> for namespaces.

I haven't commented on this if I thought it was a bad idea:)

What about the module declaration? Should it be:
  module Text.Xml.Parser where ...
or just
  module Parser where ...  -- located in Text/Xml/Parser.hs?

I prefer the latter one since I think it is wrong to specify the address
of the module in the module itself. It would be even better if the
module declaration wasn't needed at all. I don't know what it is needed

I would also like to import modules using relative addresses, e.g. the
  import .Lexer  -- Relative path to the module: My.Small.Test.Xml.Lexer
  import ..Data  -- Relative path to the module:
  import Text.ParserCombinators.HuttonMeijer  -- Absolute address

When the world realize that this is the XML parser, they won't accept
the name and I refuse to change my implementation. The only thing that
is needed to rename (an unused) module hierarchy is to move it. 

import Std.Module
import .Sibling
import .Sibling.Child
import ..Child
import ..Child.GrandChild
import ...Syntax.Error  -- This isn't allowed

Christian Brolin