Summary of progress
Johannes Waldmann
joe@isun.informatik.uni-leipzig.de
Tue, 13 Mar 2001 08:50:53 +0100 (MET)
Two remarks on what Malcolm wrote:
> I don't see the need to bring whole namespaces into scope.
> And even if I did, I wouldn't overload the standard import syntax
> to mean namespace scoping as well -
Well, the syntax *is* overloaded already :-) `import' serves two purposes:
a) declare what modules you want to access
b) declare how you want to name entities from these modules.
Java drops a) - technically, you could write Java programs
without any `import's, by using fully qualified names everywhere.
Ada separates a) and b) - it has `with' for a) and `use' for b). (*)
Why do we want a) for Haskell? Sure it's easier to implement
(but that alone would be a bad excuse) the main reason is
that it serves to document the code (namely, its dependecy on other modules),
and allows to enforce some coding standards. (**)
(*) The advantage (in my eyes) of having these concerns separated
is that you can have local `use' statements, i. e. at the top of your module,
you have to `with' all packages that you want to access,
but you can write `use' statements (that bring their namespace into scope)
not only at the top level, but also at local binding groups.
(Is this the same as `open' in ML? - I confess I don't know ML.)
(**) I use this feature in the following way: students send me their homework
in the form of a Haskell module that contains a definition like
solution :: Push_Down_Automaton
solution = Push_Down_Automaton { states = .., transitions = .., .. }
and I then (automatically) run a test program that imports their module.
Of course I want to be sure that they don't do some hidden IO stuff
and wipe my hard disk - but this is nicely ensured by Haskell's
type and module system: the typechecker verifies that the type of `solution'
is pure (and not IO something), and I can easily check textually
that they don't `import IOExts', which would allow `unsafePerformIO'.
(However, I can't simply remove hugs/lib/exts/IOExts.hs
because `runhugs' wants it - I don't really see why?)
Yes I see that this doesn't necessarily advance the discussion of
the standard library layout.
--
-- Johannes Waldmann ---- http://www.informatik.uni-leipzig.de/~joe/ --
-- joe@informatik.uni-leipzig.de -- phone/fax (+49) 341 9732 204/252 --