Problem with hierarchical libraries in Hugs compared to ghc/nhc98

Ross Paterson ross@soi.city.ac.uk
Fri, 7 Mar 2003 18:03:09 +0000


On Fri, Mar 07, 2003 at 05:44:27PM +0000, Olaf Chitil wrote:
> Ross Paterson wrote:
> > On Fri, Mar 07, 2003 at 02:35:47PM +0000, Olaf Chitil wrote:
> > > The simple reason why Hugs behaves so is that when searching a module it
> > > *always* searches the current directory (* where the import was demanded
> > > *) first. Only afterwards the paths set with the -P option are searched.
> >
> > This is a clear flaw in Hugs (long known, but hard to fix).  A workaround
> > is to add the -X option to stop it adding the extra directory.
> 
> Thank you very much for pointing me to the -X option which I had not
> noticed before.
> 
> 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.)

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.