Proposal: module namespaces.

Malcolm Wallace Malcolm.Wallace@cs.york.ac.uk
Tue, 27 Feb 2001 16:59:42 +0000


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

The former.  The reason is that a compiler needs to generate a unique
linker symbol for each defined function.  If the full module name is
not encoded in the source file, you will need to add a commandline
option to the compiler, which is the wrong way to go in my opinion.

Why is  e.g. Parser.f  not sufficient as a unique symbol for
Text.Xml.Parser.f?  Well, what if you also have Text.Html.Parser.f?
You really need the full thing.

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

I'm sorry, I don't entirely follow what the differing numbers of
initial dots mean.

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

If you refuse to change your implementation, someone else will change
it for you!  You can't have closed standards.

Regards,
    Malcolm