Has the Ada solution been properly considered? What I really like about
Ada packages is that you have `with' and `use' as separate operations
(on namespaces). Typical (simplified) examples are:

        Put_Line ("Foo."); -- won't work

        with Text_Io; Text_Io.Put_Line ("Foo."); -- will work

        with Text_Io; Put_Line ("Foo."); -- won't work

        with Text_Io; use Text_Io; Put_Line ("Foo."); -- will work

        use Text_Io; Put_Line ("Foo."); -- won't work

That is, `with Bar' makes module Bar's namespace accessible,
but prefixed with that module's name. On the other hand, 
`use Bar' adds `Bar.' to a set of default prefixes that are
tried when looking up names from then on. If an ambiguity arises,
the compiler complains. You may resolve this by using the prefixed name.

You can only `use' what you have `with'ed,
and all `with's have to go at the very start of a module,
so you (or a configuration management system) 
can easily check on what packages your code depends.

With present Haskell modules, it seems that `with'
automatically comes with `use' and clutters up your namespace.
That's why you sometimes need re-naming when importing.

(As I'm mostly using Gofer/Hugs, you may imagine that I'm not so
sure about Haskell modules. However, I _do_ like the Ada solution.
Please correct me if the above is basically wrong or inapplicable.)

-- 
Johannes Waldmann, Institut f\"ur Informatik, UHH, Jena, D-07740 Germany,
(03641)  630793  [EMAIL PROTECTED]  http://www.minet.uni-
jena.de/~joe/ ...  Im naechsten Heft: Als Arbeiter in einer Radiofabrik -
Freundschaft mit dem Sohn  eines Luftwaffengenerals - Das  KGB ueberwacht
den Amerikaner auf Schritt und  Tritt - Alarmierende Verdachtsmomente bei
der Kaninchenjagd - Ungluecklich verliebt in eine rothaarige Juedin


Reply via email to