module namespaces with "Prelude"

Johan Nordlander nordland@cs.chalmers.se
Thu, 25 Apr 2002 09:44:31 +0200


On Thursday, April 25, 2002, at 09:20 , Martin Norb=E4ck wrote:

> tor 2002-04-25 klockan 01.07 skrev Johan Nordlander:
>> One might also argue that the problem is these extra roots that
>> are implicitly added to the search path.  Arguably, dropping the
>> current directory and the directory of the importing module from
>> the search path would solve the problems listed above.  But
>> there's still a possibility to list overlapping directories in
>> the search path proper, so dropping the implicit directories
>> wouldn't really cure the disease, only make it less prominent.
>> Furthermore, this feature is there because it has been in Hugs
>> for a long time, and many people seem to rely on it quite
>> heavily.
>
> But how would adding the directory of an importing module make any
> difference?
>
> Assuming non-hierarchical names, if the importing module is found, =
then
> it's directory already must be in the seach path. So there is no =
reason
> to add it.

This is useful in combination with another traditional Hugs=20
feature: to load or import a module using its concrete=20
filename.  That is, if I write

   :l "/some/exotic/directory/module.hs"

the directory "/some/exotic/directory/" is implicitly added to=20
the search path during processing of any import clauses within=20
module.hs.

I admit that it is a dubious feature, but it (too) seems to be=20
widely in use.

>> All in all, dropping all implicit directories from the search
>> path gets my vote.
>
> Dropping all implicit directories but the current directory gets mine.

A reasonable compromise, although it wouldn't address the last=20
two examples of module confusion that Alastair reported.

-- Johan