Problem with hierarchical libraries in Hugs compared to ghc/nhc98
Mon, 10 Mar 2003 19:53:57 +0000
Ross Paterson wrote:
> > Why is it hard to fix if -X actually exists? Why not have -X as default?
> > Is the current default behaviour good for anything?
> Suppose you load a file with some long name. You'd like that module to
> be able to import other modules in (or relative to) the same directory.
> This is important for runhugs, but also for the normal interpreter.
> (Only works if the original module has a non-heirarchical name, of course.)
Yes, this makes sense.
> In my opinion the correct fix is to add the directory only if the parent
> module was specified with a path, or was itself found relative to that
> added directory.
I agree. So a search directory is only passed on recursively, if the
imported module is actually found in that directory.
So there is at most one added path. However, because Hugs has this
extension of allowing paths in import declarations, the path may be
different for every module.
I suppose one problem with fixing Hugs' behaviour is that it currently
does not distinguish modules with path and hierarchical names, that is,
e.g. Test/A and Test.A
I have to admit that I think that all this becomes rather complicated
and I wonder if it would not be better to just require the user to set
the search path with -P and not use any explicit paths in module names.
Dept. of Computer Science, The University of York, York YO10 5DD, UK.
Tel: +44 1904 434756; Fax: +44 1904 432767